I am trying to solve
$y'' + y = \tan(t) + \sin(t) + 1$
through variation of parameters using an arbitrarily chosen constraint. The homogeneous solution is $y_h = C\cos(t) + D\sin(t)$, so the particular solution will be $y = v(t)\cos(t) + w(t)\sin(t)$. Differentiating this, $y_p\ ' = v'\cos(t) - v\sin(t) + w'\sin(t) + w\cos(t)$.
Instead of constraining the first derivative terms to be $0$, I'll set them to $t - \cos(t)$, so that $y_{"p"}\ ' = -v\sin(t) + w\cos(t) + t - \cos(t)$, leading to the system $$\begin{cases} v'\cos(t) + w'\sin(t) = t -\ cos(t) \\ -v'\sin(t) + w'\cos(t) = \tan(t) \end{cases}$$ which via elimination becomes $$\begin{cases} v'= t\cos(t) - \cos^2(t) - \sin(t)\tan(t) \\ w' = t\sin(t) - \sin(t)\cos(t) + \sin(t) \end{cases}$$
In the end, I get $$y_p = -\frac{\sin(2t)\cos(t) + 2\sin(t)\cos^2(t) + 2t\cos(t) + 4\cos^2(t) + 2\cos(t)\ln|\frac{1 + \sin(t)}{1 - \sin(t)}|}{4}$$ However, when I subtract the book's answer of $y_p = 1 - \frac{1}{2}t\cos(t) - \cos(t)\ln|sec(t) + \tan(t)| + \frac{1}{4}$ from mine, the resulting Desmos graph doesn't looks like a "regular" sine or cosine wave, which according to my understanding is what a linear combination of sine and cosines with the same input must look like.
Is my answer indeed incorrect? If so, is it due to an error in computation somewhere, or an illegal choice of constraint?
Use the following relations between functions, derivatives and anti-derivatives
We get for the variable coefficients \begin{align} v(t)&=[t\sin t+\cos t]-\frac12[t+\sin t\cos t]-\frac12\ln\left|\frac{1+\sin t}{1-\sin t}\right|+\sin t, ~~\\ w(t)&=[\sin t -t\cos t]-\frac12\sin^2t - \cos t, \end{align}
Inserting into the formula for the particular solution then results in so that \begin{align} y_p(t)=v(t)\cos t+w(t)\sin t&= \begin{aligned}[t] [&t\sin t\cos t+\cos^2t+\sin^2t-t\cos t\sin t] \\&~~-\frac12[t\cos t+\sin t\cos^2t+\sin^3 t] \\&~~-\frac12\ln\left|\frac{1+\sin t}{1-\sin t}\right|\cos t+\sin t\cos t-\cos t\sin t \end{aligned} \\&= 1 -\frac12t\cos t-\frac12\sin t-\frac12\ln\left|\frac{1+\sin t}{1-\sin t}\right|\cos t \end{align} Here there is one part of the homogeneous solution in $-\frac12\sin t$, so it can be removed from the particular solution. Note that by modifying the fraction inside the logarithm by the same factor in numerator and denominator one gets $$\frac{1+\sin t}{1-\sin t}=\frac{(1+\sin t)^2}{1-\sin^2t}=\left(\sec t+\tan t\right)^2,$$ which shows the equivalence to the book solution.
One could also treat the parts on the right side of the ODE separately, as the ODE is linear. Then $y_{p,3}=1$ is the quite obvious particular solution to $y''+y=1$, that $y''+y=\sin t$ has $y_{p,2}(t)=-\frac12t\cos t$ as particular solution is also fairly standard and easy to compute with the method of undetermined coefficients. The only "real" computation is needed for $y_{p,1}$, the solution to $y''+y=\tan t$.