TITLE: Is this proof of Euler's formula correct?
QUESTION [7 upvotes]: Let 
$$y=\cos \phi+i\sin \phi  \tag{1}$$
Differentiating both sides of equation (1) with respect to $\phi$, we get, 
$$\begin{align}
\frac{dy}{d\phi} &=-\sin \phi+i\cos \phi \\
&=i(\cos \phi-\frac{1}{i}\sin \phi) \\
&=i(\cos\phi+i\sin \phi) \\
&=iy \\
\implies\frac{1}{y}dy &=i\;d\phi \tag{2}
\end{align}$$
Integrating both sides of equation (2), we get,
$$\begin{align}
\int\frac{1}{y}dy&=\int i\;d\phi \\
\implies \ln(y)&=i\phi+c \tag{3}
\end{align}$$
Substituting $\phi=0$ in equation (1), we get, 
$$y=\cos 0+i\sin 0 \implies y=1 \tag{4}$$
Substituting $\phi=0$ and $y=1$ in equation (3) we get,
$$\ln(1)=c \implies c=0 \tag{5}$$
Substituting $c=0$ in equation (3) we get, 
$$\begin{align}
\ln(y)&=i\phi \tag{6}\\
\implies e^{i\phi}&=y \tag{7}\\
\therefore e^{i\phi}&=\cos \phi+i\sin \phi \tag{8}
\end{align}$$
I found this proof in a book. I think that there is a problem. In $(3)$ and $(6)$, shouldn't $\ln(y)$ be $\ln|y|$ instead? Or is it that, for complex numbers, we do not take the absolute value of the number within the $\ln$?

REPLY [4 votes]: Your proof is correct, but there are some hidden assumptions which your book has conveniently failed to mention.
In particular the key assumption is the definition of symbol $e^{iy} $ for $y\in\mathbb{R} $ or equivalently the definition of $\log z$ for $z\in\mathbb{C} $.
One approach is to define $e^z, z\in\mathbb{C} $ via the limit $$e^z=\lim_{n\to\infty} \left(1+\frac{z}{n}\right)^n\tag{1}$$ or via the series $$e^z=1+z+\frac{z^2}{2!}+\frac{z^3}{3!}+\dots\tag{2}$$ Using any of the above definitions one can easily prove that $e^{iy} =\cos y+i\sin y$. In particular the series definition can be used with the proof you have provided. Using series definition one can prove that if $f(y) =e^{iy} $ then $f'(y) =if(y) $ and then we can use the function $$g(y) =f(y) (\cos y-i\sin y) $$ to establish $g'(y) =0$ so that $g$ is constant. Thus $g(y) =g(0)=1$ and $f(y) =\cos y+i\sin y$.
The proof using limit definition $(1)$ is more interesting and you may have a look at it. Both the approaches avoid integrals altogether.