\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\un}{\underline}
\parindent=0pt
\begin{document}

{\bf Question}

Solve the equations
\begin{description}
\item[(i)]
$\ds\frac{d^2y}{dx^2}+4y=8$

\item[(ii)]
$\ds\frac{d^2y}{dx^2}-4\ds\frac{dy}{dx}+3y=4e^{3x}$

\item[(iii)]
$\ds\frac{d^2y}{dx^2}+2\ds\frac{dy}{dx}+y=e^x \sin x$
\end{description}

\medskip

{\bf Answer}
\begin{description}
\item[(i)]
$\ds\frac{d^2y}{dx^2}+4y=8$ This is a CF+PI solution.

CF: $\ds\frac{d^2y}{dx^2}+4y=0$,

auxiliary equation $\Rightarrow k^2+4=0 \Rightarrow \un{k=\pm 2i}$

Hence CF is \un{$y=C\cos 2x+D\sin 2x$}

PI: $\ds\frac{d^2y}{dx^2}+4y=8$

a constant, so from notes try $y=const=\alpha$, say.

So, substituting into the full equation,

$$0+4\alpha=8 \Rightarrow \alpha=2$$

Thus the PI is \un{$y=2$}

The solution is CF+PI

$$\un{y=C\cos 2x+D\sin 2x+2}$$

\item[(ii)]
$\ds\frac{d^2y}{dx^2}-4\ds\frac{dy}{dx}+3y=4e^{3x}$ This is a
CF+PI solution.

CF: $\ds\frac{d^2y}{dx^2}-4\ds\frac{dy}{dx}+3y=0$,

auxiliary equation $k^2-4k+3=0 \Rightarrow (k-1)(k-3)=0
\Rightarrow k=1,3$

Hence CF is \un{$y=Ae^x+Be^{3x}$}

Now PI: Note that $f(x)=4e^{3x}$, but $e^{3x}$ occurs in the CF,
thus we \un{can't} try a PI solution $y=Le^{3x}$,as $L$ will turn
out to be zero.

Thus try the solution $y=Lxe^{3x}$

\begin{eqnarray*} y & = & Lxe^{3x}\\ \ds\frac{dy}{dx} & = & Le^{3x}(3x+1)\\
\ds\frac{d^2y}{dx^2} & = & Le^{3x}(6+9x) \end{eqnarray*}

Thus substitute into the full equation:

$\ Le^{3x}(6+9x)-4Le^{3x}(3x+1)+3Lxe^{3x}=4e^{3x}$

$\Rightarrow L(5+9x-12x-4+3x)=4$

$\Rightarrow L=2$

Thus the PI is \un{$y=2xe^{3x}$}

Hence the general solution is CF+PI

$$\un{y=Ae^x+Be^{3x}+2xe^{3x}}$$

\item[(iii)]
$\ds\frac{d^2y}{dx^2}+2\ds\frac{dy}{dx}+y=e^x \sin x$

This is a CF+PI solution

CF: $\ds\frac{d^2y}{dx^2}+2\ds\frac{dy}{dx}+y=0$, auxiliary
equation is

$k^2+2k+1=0 \Rightarrow (k+1)^2=0 \Rightarrow \un{k=-1}$

Hence CF is (from notes)

$$\un{y=(A+Bx)e^{-x}}$$

The PI: Here $f(x)=e^x\sin x$, so try a solution

\begin{eqnarray*} y & = & e^x(L\sin x+M\cos x)\\ \ds\frac{Dy}{dx}
& = & e^x([L+M]\cos x+[L-M]\sin x)\\ \ds\frac{d^2y}{dx^2} & = &
2e^x(L\cos x-M\sin x) \end{eqnarray*}

So substituting into the full equation,

$2e^x(L\cos x-M\sin x)+2e^x([L+M]\cos x+[L-M]\sin x)$

$+e^x(L\sin x+M\cos x)= e^x\sin x$

So compare coeffs of $e^x \cos x$

$2L+2L+2M+M=0 \Rightarrow 4L+3M=0\ \ \ (1)$

Compare coeffs of $e^x\sin x$

$-2M-2M+2L+L=1 \Rightarrow 3L-4M=1\ \ \ (2)$

From $(1)$ and $(2)$ must solve simultaneously for $L$ and $M$.

Take $3 \times (1)-4\times(2)$

$\begin{array} {r} 12L+9M =\ 0\\ \un{12L-16M=\ 4}\\ 25M=-4
\end{array}$

$\Rightarrow \un{M=-\ds\frac{4}{25}}$

Hence in $(1)$, $4L=-3M=\ds\frac{12}{25} \Rightarrow
\un{L=\ds\frac{3}{25}}$

Thus PI is

$$\un{y=\ds\frac{e^x}{25}(3\sin x-4\cos x)}$$

Hence the general solution is: CF+PI

$$\un{y=(A+Bx)e^{-x}+\ds\frac{e^x}{25}(3\sin x-4\cos x)}$$

\end{description}
\end{document}
