Undetermined coefficient guessing the particular solution for $y^{"}+k^2y=\sin(kx)$. since the homogeneous solution also has the same form as the nonhomogeneous part I was a bit confused on how to guess the form of the particular solution. any help is greatly appreciated.
My guess is the following
$$Y_P =C \sin(kx) +D \cos(kx)$$ 
but I think the correct guess would be $Y_P=(C+Dx)(A\sin(kx) + B\cos(kx))$ where the $A\sin(kx)+B\cos(kx)$ is our homogeneous solution.
 A: As you mentioned the homogeneous solution is
$${y_h} = A\cos (kx) + B\sin (kx)\tag{1}$$
and hence your particular solution $y_p$ surely cannot be like $(1)$ as it just make the LHS of the ODE being zero, leaving you with nothing! :)
So we may try particular solutions of the form
$${y_p} = Cx\sin (kx) + Dx\cos (kx)\tag{2}$$
Put it into the ODE to obtain
$$\begin{array}{l}
C\left[ {(2k\cos (kx) - {k^2}x\sin (kx) + {k^2}x\sin (kx)} \right] + \\
D\left[ {( - 2k\sin (kx) - {k^2}x\cos (kx) + {k^2}x\cos (kx)} \right]\\
 = 2Ck\cos (kx) - 2Dk\sin (kx) = \sin (kx)
\end{array}\tag{3}$$
and hence
$$\left\{ \begin{array}{l}
C = 0\\
D =  - \frac{1}{2k}
\end{array} \right.\tag{4}$$
and finally your particular solution is
$${y_P} =  - \frac{1}{2k}x\cos (kx)\tag{5}$$
and your general solution will be
$$y = {y_h} + {y_p} = A\cos (kx) + B\sin (kx) - \frac{1}{2k}x\cos (kx)\tag{6}$$
A: Your first guess is the general solution of the homogeneous equation. The correct guess is what you believe to be correct, where you can take $C=0$ and $D=1$.
