\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\un}{\underline}
\parindent=0pt
\begin{document}

{\bf Question}
\begin{description}
\item[(a)]
Solve the differential equation

$\ds\frac{dy}{dx}=e^x \cos^2 y$, where $y=\ds\frac{\pi}{4}$ when
$x=0$.

\item[(b)]
Solve the differential equation

$x\ds\frac{dy}{dx}+y=\sec x$, where $y=1$ when $x=0$.

\end{description}
{\bf{Hint:}} All the integrals you need are in the table at the
end of the exam paper.
\medskip

{\bf Answer}
\begin{description}
\item[(a)]
$\sec y \ds\frac{dy}{dx}-e^x \cos y=0$

rewrite as

$\ds\frac{dy}{dx}=e^x\ds\frac{\cos y}{\sec y}=e^x \cos^2 y$

This is variables separable

$\Rightarrow \ds\int\ds\frac{dy}{\cos^2 y}=\ds\int e^x dx$

$\Rightarrow \ds\int\sec^2 y \,dy=e^x+c'$

$\Rightarrow \tan y=e^x+c$

Now $y=\ds\frac{\pi}{4}$ when $x=0$

Therefore $\tan\ds\frac{\pi}{4}=e^0+c$

$\Rightarrow 1=1+c$

$\Rightarrow c=0$

Therefore \un{$\tan y=e^x$}

or \un{$y=\arctan(e^x)$}

on some restricted range of $y$

\newpage
\item[(b)]
Rewrite as

$\ds\frac{dy}{dx}+\ds\frac{y}{x}=\ds\frac{\sec x}{x}$ cf
$\ds\frac{dy}{dx}+P(x)y=Q(x)$

It's linear first order $\Rightarrow$ integrating factor or exact

\begin{eqnarray*} I.F. & = & e^{\int\frac{1}{x}} dx\\ & = & e^{\ln
x}\\ & = & x \end{eqnarray*}

$\begin{array} {lrcl} \rm{Therefore} &
x\ds\frac{dy}{dx}+x\ds\frac{y}{x} & = & x\ds\frac{\sec x}{x}\\
\rm{Therefore} & \ds\frac{d}{dx}(xy) & = & \sec x\\ \Rightarrow &
xy & = & \ds\int\sec x dx\\ & & = & \ln|\sec x+\tan x|+c\\
\Rightarrow & y & = & \ds\frac{1}{x}(\ln|\sec x+\tan x|+c)
\end{array}$

Now $y=1$ when $x=0$ so go back one line.

\begin{eqnarray*} 0 \times 1 & = & \ln |\sec 0 + \tan 0|+c\\
\Rightarrow 0 & = & \ln(1)+c\\ \Rightarrow c & = & 0
\end{eqnarray*}

Therefore \un{$y=\ds\frac{\ln|\sec x+\tan x|}{x}$}

\end{description}


\end{document}
