Answer
General Solution is $y(t) = c_1\sin(t)+c_2\cos(t) -\cos(t)\ln|\sec(t)+\tan(t)|$
Work Step by Step
$$y{''}+y = \tan{t}$$
$$g(t) = \tan(t)$$
To find the complementary function $y_c(t)$, consider the homogeneous part
$$y''+y=0$$
Corresponding characteristic equation is:
$$m^2+1=0$$
$$ m = \pm \iota $$
Hence, Complementary function is:
$$y_c(t) = c_1\sin(t)+c_2\cos(t)$$
Hence Independent solutions $y_1(t)$ and $y_2(t)$ will be
$$y_1(t) = \sin(t) \text{ and } y_2(t) = \cos(t)$$
Particular Solution $y_p(t)$ is given by:
$$y_p(t) = u_1(t)y_1(t)+u_2(t)y_2(t)$$
where $$u_1(t) = -\int \frac{y_2(t)g(t)}{W(y_1,y_2)(t)}dt + c_3$$
$$u_2(t) = \int \frac{y_1(t)g(t)}{W(y_1,y_2)(t)}dt+c_4$$
Since, $y_p(t)$ is a particular solution so we can choose $c_3=c_4=0$ such that both the constant terms vanishes.
$$W(y_1, y_2)(t) =
\begin{vmatrix}
\sin(t) & \cos(t) \\
\cos(t) & -\sin(t)
\end{vmatrix}=-1$$
$$u_1(t) = -\int \frac{\cos(t) \tan(t)}{-1}dt = -\cos(t)$$
$$u_2(t) = \int \frac{\sin(t)\tan(t)}{-1}dt = \int \frac{-\sin^2t}{\cos{t}}dt$$
$$u_2(t) = \int \frac{\cos^2t-1}{\cos(t)}dt$$
$$u_2(t) = \int (\cos(t) - \sec(t))dt$$
$$u_2(t) = \sin(t) - \ln|(\sec(t)+\tan(t))|$$
$$\therefore y_p(t) = -\cos(t)\sin(t)+[\sin(t)-\ln|\sec(t)+\tan(t)|]\cos(t)$$
$$\therefore y_p(t) = -\cos(t)\ln|\sec(t)+\tan(t)|$$
Therefore, the general solution is:
$$y(t) = y_c(t)+y_p(t)$$
$$y(t) = c_1\sin(t)+c_2\cos(t) -\cos(t)\ln|\sec(t)+\tan(t)|$$