# Analytic function with constant imaginary part

While learning some consequences of the Cauchy-Riemann theorem. we learned that

An analytic function with constant imaginary (or real) part is constant.

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 $f(x+iy) = x + 2i$ is not analytic! That is because the function $x+iy \mapsto x$ is not analytic. Why did you think it is? Try computing the complex derivative of the real part function (or the imaginary part function). Don't confuse real-analytic and complex-analytic functions. The CR equations are related to complex-analytic functions.
– KCd
Nov 7, 2021 at 7:02
• @KCd: thank you! I completely missed it unfortunately :( Nov 7, 2021 at 16:10

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.