Answer
See below
Work Step by Step
Given $y''+y=\tan x$
In this case the substitution $y(x) = e^{rx}$ yields the indicial equation
$r^2+1=0$
It follows that two linearly independent solutions to the given differential equation are
$y_1(x)=\sin x\\
y_2(x)=\cos x$
so that the general solution is
$y(x)=u_1\sin x+u_2\cos x$
We first compute the appropriate derivatives
$y'=e^{rx}(u'+u)=u_1'(x)\sin x+u_2'(x)\cos x\\
y''=e^{rx}(u''+u)=u_1'(x)(\sin x)'+u_2'(x)(\cos x)'$
Substituting these expressions into the given equation, we find that $u$ must satisfy
$-u_1'(\cos x+\frac{\sin^2 x}{\cos x})=\tan x\\
\rightarrow u_1'(x)=\sin x\\
\rightarrow u_1(x)=-\cos x$
and $u_2'(x)=-\sin x \tan x\\
\rightarrow u_2(x)=\sin x-\ln (\sec x+\tan x)$
Hence, the general solution is:
$y(x)=C_1\sin x+C_2\cos x-\cos x\ln(\sec x+\tan x)$