So, I was resolving the problem 1.9.13 from "George B Arfken, Hans J Weber - Mathematical Methods For Physicists- Sixth edition", what a need to show is that: $\begin{equation}\psi = \frac{1}{2}k\phi^2\end{equation}$ is a solution for the equation $\nabla^2\psi = k\lvert\nabla\phi\lvert^2$ with $\nabla^2\phi = 0$, where $\phi$ and $\psi$ are scalar functions. I was able to show that by doing:
$\begin{equation}\nabla\cdot(\nabla\psi) = k\lvert\nabla\phi\lvert^2 = k\lvert\nabla\phi\lvert^2 + \underbrace{k\phi\nabla\cdot(\nabla\phi)}_{k\phi\nabla^2\phi = 0} = \nabla\cdot(k\phi\nabla\phi)\implies k\phi\nabla\phi = \nabla\psi\end{equation}$
Since $\nabla\phi\cdot d\vec{r} = d\phi$ and $\nabla\psi\cdot d\vec{r} = d\psi$:
$\begin{equation}k\phi d\phi = d\psi\end{equation}$ integrating both sides I have $\begin{equation}\int k\phi d\phi = \int d\psi \implies \psi = \frac{1}{2}k\phi^2\end{equation}$
But I have to say that I'm feeling a little guilty, I was only able to solve that because I already know the answer, so I first applied the gradient on both sides of $\begin{equation}\psi = \frac{1}{2}k\phi^2\end{equation}$ and I saw that I needed to put the null term $k\phi\nabla\cdot(\nabla\phi)$ on the equation in order to solve that. So I was wondering if is there another way to solve this equation supposing that I don't know already the answer to that. Could someone please help me with an alternative solution for that?
Certainly, if $\psi =\frac12 k\phi^2$, then we have
$$\begin{align} \nabla^2 \psi&=\frac12 k \nabla ^2 \phi^2\\\\ &=\frac12 k \nabla \cdot \nabla \phi^2\\\\ &=\frac12k \nabla \cdot (2\phi \nabla \phi)\\\\ &=k\nabla \cdot (\phi \nabla \phi)\\\\ &=k\phi \nabla^2\phi +k\nabla \phi \cdot \nabla \phi\\\\ &=k|\nabla \phi|^2 \end{align}$$
And we are done!
If we begin with the equality $\nabla^2 \psi=k|\nabla \phi|^2$, then using $\nabla^2\phi=0$, we find that
$$\begin{align} 0&=\nabla^2 \psi-k|\nabla \phi|^2\\\\ &=\nabla\cdot \left(\nabla \psi-k\phi \nabla \phi\right)\\\\ &=\nabla\cdot \nabla \left(\psi-\frac12 k\phi^2\right)\\\\ \end{align}$$
Note that both the curl and divergence of the vector $\nabla \left(\psi -\frac12 k\phi^2\right)$ are equal to $0$. If $\lim_{r\to \infty}r\nabla(\psi-\frac12 k\phi^2)=0$, then appealing to Helmholtz's Theorem we assert that $\nabla \left(\psi -\frac12 k\phi^2\right)=0$.
This implies that $\psi=\frac12 k\phi^2 +C$, where $C$ is a constant. If we demand that $\psi=\frac12k \phi^2$ at any point, then we conclude that $\psi =\frac12k\phi^2$.