Problem: Prove that the function
\[
u(x,y) = e^{-x} \left( x \sin y - y \cos y \right)
\]
is harmonic. Furthermore, find a function $v$ such that $f(z) = u + \iota v$ is analytic.
Solution: We recall that a function $f(x,y)$ is harmonic if the laplacian
\[
\Delta f = f_{xx} + f_{yy} = 0.
\]
Let us compute the second partial derivatives of $u$.
\begin{align*}
u_x & = - e^{-x} \left( x \sin y - y \cos y \right) + e^{-x} \left( \sin y \right) \\
& = e^{-x} \left( \sin y-x\sin y + y\cos y \right) \\[2ex]
u_{xx} & = e^{-x}\left( -\sin y + x\sin y- y\cos y - \sin y \right) \\
& = e^{-x}\left( -2\sin y + x\sin y- y\cos y\right) \\[2ex]
u_y & = e^{-x}\left( x\cos y - \cos y + y\sin y \right) \\[2ex]
u_{yy} & = e^{-x}\left( -x\sin y + \sin y + \sin y + y \cos y \right) \\
& = e^{-x} \left( 2\sin y- x \sin y + y \cos y \right) .
\end{align*}
Therefore,
\begin{align*}
\Delta u & = u_{xx} + u_{yy} \\
& = e^{-x}\left( \textcolor{red}{-2\sin y} + \textcolor{blue}{x\sin y} - \textcolor{teal}{y\cos y}\right) \\
& \kern 0.5cm + e^{-x} \left( \textcolor{red}{2\sin y} - \textcolor{blue}{x \sin y} + \textcolor{teal}{y \cos y} \right)\\
& = 0.
\end{align*}
Hence, we proved that $u$ is a harmonic function.
Now in order to find its harmonic conjugate $v$, we will use the Cauchy-Riemann equations. Recall that if $f = u + \iota v$ is analytic, then it must satisfy Cauchy-Riemann equations given by
\begin{align*}
u_x = v_y \text{ and } u_y = -v_x .
\end{align*}
Therefore, we have
\begin{align*}
& v_y = e^{-x} \left( \sin y-x\sin y + y\cos y \right) \\
\implies & v = \int \left[ e^{-x} \left( \sin y-x\sin y + y\cos y \right) \right] \mathrm{d} y \\
& \kern 0.2cm = e^{-x} \left( -\cos y + x \cos y + y \sin y + \cos y \right) + g(x)\\
& = \kern 0.2cm e^{-x} \left( x\cos y + y \sin y \right) + g(x),
\end{align*}
where $g(x)$ is an arbitrary function of $x$ only.
Now again from the Cauchy-Riemann equations, we have $v_x = - u_y$, which implies,
\begin{align*}
& e^{-x} \left( - x\cos y + \cos y - y\sin y \right) + g'(x) \\
& \kern 1cm = e^{-x}\left( -x\cos y + \cos y - y\sin y \right) \\
\implies & g'(x) = 0 \implies g(x) = k,
\end{align*}
where $k$ is a constant. Thus,
\[
v(x,y) = e^{-x} \left( x \cos y + y \sin y \right) + k.
\]