In separation of variables, one can assume a solution of V(x,y) = X(x)Y(y) and after plugging this into Laplace's equation which is: ${{\partial^2 V} \over {\partial x^2}}$ + ${{\partial^2 V} \over {\partial y^2}}$ = 0 we can get:
${d^2X \over dx^2}$ = ${k^2X}$ which gives a solution ${X(x) = Ae^{kx} - Be^{-kx}}$?
and
${d^2Y \over dy^2}$ = ${-k^2Y}$ which gives solution ${Y(y) = C\sin(ky) - D\cos(ky)}$
(where k is some constant) However, I can't understand, why does positive ${k^2}$ give a solution with exponents and ${-k^2}$ has sinusoidal solution? Is it always so?
The book that I am referencing this from is Griffith 3rd edition of "Intro to Electrodynamics". He does mention this there: "If X were sinusoidal, we could never arrange for it to go to zero at infinity, and if Y were exponential we could not make it vanish at both zero and a."
But I don't quite see this? Also, the image used is:

Ps: I'm sorry if this has been asked before on this site. If it has, could someone please direct me to the answer, since I could not find it?
If you solve the differential equation $\frac{d^2 X}{dx^2} - k^2 X = 0$, then let $X=e^{mx}$ so that you get the auxiliary equation $m^2-k^2=0$. That auxiliary equation has roots $m_1=k,m_2=-k$, which are real. If you plug the roots to the formula $$y=A e^{m_1 x}+ B e^{m_2 x}$$ you will get a solution with exponents.
If you solve the differential equation $\frac{d^2 X}{dy^2} + k^2 X = 0$, then let $X=e^{my}$ so that you get the auxiliary equation $m^2+k^2=0$. That auxiliary equation has roots $m_3=ki,m_4=-ki$, which are imaginary. If you plug the roots to the formula $$y=C e^{m_3 x}+ D e^{m_4 x}$$ you will get a sinusoidal solution.