While learning some consequences of the Cauchy-Riemann theorem. we learned that
An analytic function with constant imaginary (or real) part is constant.
and in addition,
Sum of analytic functions is analytic.
Given the second proposition, I understand that the function $f(x+iy)=x+2i$ is analytic. On the other hand, from the first proposition, it must be constant, but it is not (it depends on $x$, which is not a constant.
How can this contradiction be settled? What am I getting wrong here?
Thank you
The function you considered here is $x+2i$. Now, your logic is that the function $``x"$ is analytic and the function $``2i"$ is analytic (although constant). Now, you argument is that sum of two analytic function is constant.
What gone wrong here is the assumption that your first function $``x"$ is analytic. The function $g(x+iy)=x$ is not analytic at all, since its imaginary part is zero, i.e., constant. By your first result, if $g$ has to be analytic, then it must be constant, as its imaginary part is constant. However, g is clearly not a constant function.