Solving a differential equation involving a trigonometric function Our task is to find a solution of this inhomogeneous equation:
$$\frac {d^2u}{d{\phi}^2}+{u}=\frac{k}{b^2}{\cos^2}{\phi} .$$ 
We have to make a qualified guess at the form of the solution.  Looking at the right side of the equation we are led to guess that the solution looks like 
$$us=A\cos^2 \phi+B ,$$ 
where $A$ and $B$ are constants.  We compute the constants $A$ and $B$ and show that the particular solution is given by
$$us=\frac {k}{b^2}(2-\cos^2 \phi) .$$
Source: http://www.uio.no/studier/emner/matnat/math/MAT1001/h15/oblig2_eng.pdf
This is a mandatory task. Task g) on the link. 
Is it right to begin like this 
$$\frac{d}{d\phi} \left( \frac{d}{d\phi} A\cos^2 \phi+B \right) ?$$ 
Or do I plug in numbers of my choice like 2?
 A: First, notice that your equation is not as difficult as it seems, since $\cos^2 \phi=\frac{1}{2}+\frac{1}{2}\cos 2\phi$. You could then solve $u''+u=1$ and $u''+u=\cos2\phi$, which are easy, and use linearity.
Anyway, you have $u=A\cos^2\phi+B$, differentiate twice:
$$\frac{du}{d\phi}=-2A\cos\phi\sin\phi=-A\sin 2\phi$$
$$\frac{d^2u}{d\phi^2}=-2A\cos2\phi=-2A(2\cos^2\phi-1)$$
Thus
$$\frac{d^2u}{d\phi^2}+u=-2A(2\cos^2\phi-1)+A\cos^2\phi+B=-3A\cos^2\phi+(2A+B)$$
And you want this to be equal to $\frac{k}{b^2}\cos^2\phi$, hence
$$\left\{\begin{eqnarray}-3A & = & \frac{k}{b^2} \\
2A+B & = & 0\end{eqnarray}\right.$$
$$\left\{\begin{eqnarray}A & = & -\frac{k}{3b^2} \\
B & = & -2A=\frac{2k}{3b^2}\end{eqnarray}\right.$$
And your solution is
$$u=\frac{k}{3b^2}\left(2-\cos^2\phi\right)$$
And by the way, you made a typo when copying the question, you forgot the $3$ in denominator.
A: HINT (if you know Laplace Transform):
Substitute $y(x)=u(\phi)$:
$$y''(x)+y(x)=\frac{k}{b^2}\cos^2(x)\Longleftrightarrow$$ 
$$\mathcal{L}_{x}\left[y''(x)\right](s)+\mathcal{L}_{x}\left[y(x)\right](s)=\mathcal{L}_{x}\left[\frac{k}{b^2}\cos^2(x)\right](s)\Longleftrightarrow$$ 
$$s^2\mathcal{L}_{x}\left[y(x)\right](s)-sy(0)-y'(0)+\mathcal{L}_{x}\left[y(x)\right](s)=\frac{k(s^2+2)}{b^2s(s^2+4)}\Longleftrightarrow$$ 
$$(s^2+1)\left(\mathcal{L}_{x}\left[y(x)\right](s)\right)-sy(0)-y'(0)=\frac{k(s^2+2)}{b^2s(s^2+4)}\Longleftrightarrow$$ 
$$\mathcal{L}_{x}\left[y(x)\right](s)=\frac{\frac{k(s^2+2)}{b^2s(s^2+4)}+sy(0)+y'(0)}{s^2+1}\Longleftrightarrow$$ 
$$y(x)=\mathcal{L}_{s}^{-1}\left[\frac{\frac{k(s^2+2)}{b^2s(s^2+4)}+sy(0)+y'(0)}{s^2+1}\right](x)$$ 
