\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\un}{\underline}
\parindent=0pt
\begin{document}

{\bf Question}

Solve the following differential equations under the initial
conditions given

\begin{description}
\item[(i)]
$\ds\frac{d^2y}{dx^2}+2\ds\frac{dy}{dx}+5y=10x^2+3x+17$ if $y=4,
\ds\frac{dy}{dx}=0$ when $x=0$.

\item[(ii)]
$\ds\frac{d^2y}{dx^2}+9y=12\cos 3x$ if $y=0, \ds\frac{dy}{dx}=9$
when $x=0$.

\end{description}
\medskip

{\bf Answer}
\begin{description}
\item[(i)]
$\ds\frac{d^2y}{dx^2}+2\ds\frac{dy}{dx}+5y=10x^2+3x+17$

CF+PI type solution:

CF $\ds\frac{d^2y}{dx^2}+2\ds\frac{dy}{dx}+5y=0$

so auxiliary equation is $k^2+2k+5=0 \Rightarrow k=-\ds\frac{2 \pm
\sqrt{4-4 \cdot 5}}{2}$

so $k=-1 \pm 2i$

Thus we have (see notes)

CF: $\un{y=e^{-x}(C\cos 2x+D\sin 2x)}$

For PI we have $f(x)=10x^2+3x+17$ so try PI

$$\begin{array} {ccr} y & = & L+Mx+Nx^2\\ \ds\frac{dy}{dx} & = &
M+2Nx\\ \ds\frac{d^2y}{dx^2} & = & 2N \end{array}$$

Substituting into full equation:

$2N+2(M+2Nx)+5(L+Mx+Nx^2)=10x^2+3x+17$

$\Rightarrow \begin{array} {clcll} (1) & 2N+2M+5L & = & 17 &
\rm{(numbers)}\\ (2) & 4N+5M & = & 3 & \rm{(coeffs\ of}\ x)\\ (3)
& 5N & = & 10 & \rm{(coeffs\ of}\ x^2) \end{array}$

Thus from $(3),\ N=2$

Thus from $(2),\ M=\ds\frac{3-4\times2}{5}=-1$

Thus from $(1),\ L=\ds\frac{17-2\times(-1)-(2\times2)}{5}=3$

\newpage
Thus the PI is

$$\un{y=3-x+2x^2}$$

Hence CF+PI is

$$\un{y=e^{-x}(C \cos 2x+D\sin 2x)+2x^2-x+3}\ \ \ A$$

We now have to solve for the boundary conditions, i.e., identify
$C,\ D$.

$\ds\frac{dy}{dx}=e^{-x}(-2C\sin 2x+2D\cos 2x-C\cos 2x-D\sin
2x)-4x-1\ \ \ B$

When $x=0,\ y=4$, so from $A$

$$\begin{array} {cl} &4=e^0(C\cos 0 +D\sin 0)+2 \cdot 0-0+3\\
\Rightarrow & 4=C+3\\ \Rightarrow &\un{C=1} \end{array}$$

When $x=0,\ \ds\frac{dy}{dx}=0$, so from $B$

$\begin{array} {cl} 0 = e^0(-2C\sin 0+2D\cos 0-C\cos 0-D\sin
0)+5\times 0-1\\ \Rightarrow 0=2D-C-1 \end{array}$

Hence from $C=1$,

$$o=2D-2 \Rightarrow \un{D=1}$$

Thus the total solution is

$$\un{y=e^{-x}(\cos 2x+\sin 2x)+2x^2-x+3}$$

\newpage
\item[(ii)]
$\ds\frac{d^2y}{dx^2}+9y=12\cos 3x$ is a CF+PI type solution

CF: $\ds\frac{d^2y}{dx^2}+9y=0$

so auxiliary equation is

$k^2+9=0 \Rightarrow k=\pm 3i$

Thus we have (see notes)

$$\un{y=C\cos 3x+D \sin 3x}$$

PF: In this case $f(x)=12\cos 3x$ and $\cos 3x$ occurs in the CF.
Thus the usual substitution $y=A\cos 3x+B\sin 3x$ fails since
terms in $A$ and $B$ cancel and so their values can't be found.

Thus try

\begin{eqnarray*} y & = & Lx\sin 3x+Mx\cos 3x\\
\ds\frac{dy}{dx} & = & 3Lx\cos 3x+L\sin 3x-3Mx\sin 3x+M\cos 3x\\
\ds\frac{d^2y}{dx^2} & = & -(9Lx+6M)\sin 3x+(6L-9Mx)\cos 3x
\end{eqnarray*}

Substitute into full equation:

$-\sin 3x(9Lx+6M)+\cos 3x(6L-9Mx)$

$+9Lx\sin 3x+9Mx\cos 3x=12 \cos 3x$

Compare coeffs of $\sin 3x$: $-6M=0 \Rightarrow \un{M=0}$

Compare coeffs of $\cos 3x$: $6L=12 \Rightarrow \un{L=2}$

Thus PI: $\un{y=2x\sin 3x}$

Thus the CF+PI general solution is:

$$\un{y=C\cos 3x+D\sin 3x+2x\sin 3x}\ \ \ A$$

Hence $\ds\frac{Dy}{dx}=-3C\sin 3x+3D\cos 3x+2(3x\cos 3x+\sin 3x)\
\ \ B$

so if $y=0$ when $x=0$, $A$ gives

$$0=C+0+0 \Rightarrow \un{C=0}$$

and if $\ds\frac{dy}{dx}=9$ when $x=0$, $B$ gives

$$9=0+3D+2 \times 0 \Rightarrow \un{D=3}$$

Thus the final solution is

$$\un{y=3\sin 3x+2x\sin 3x=(3+2x)\sin 3x}$$
\end{description}
\end{document}
