I had some trouble on an exam recently with the particular solution of a Nonhomogeneous Second Order Ordinary Differential Equation.
So, the problem was: \begin{cases} y''+4y=\sec(2t) \\ y(0)=y'(0)=0 \\ \end{cases}
Solve the Initial Value Problem, and identify the domain of definition of the solution function.
I was able to solve for the homogeneous solution of $Y_H=c_1\sin(2t) + c_2\cos(2t)$ but I had some serious trouble with getting the particular solution.
The hint said to use either Variation of Parameters or the Green Function method. I was not able to do either of these to completion in the time allotted, and I would appreciate someone helping explain a bit about how to apply those to this equation.
EDIT: Someone below has explained how to apply Variation of Parameters to this pretty well. Can someone help explain Greens Function method to me?
Use variation of parameter $Yp=u_1(t)\sin{(2t)}+u_2(t)\cos{(2t)}$, you should set two equations:
$$u_1'(t)\sin{(2t)}+u_2'(t)\cos{(2t)}=0\\2u_1'(t)\cos{(2t)}-2u_2'(t)\sin{(2t)}=\sec{(2t)}$$
Can you continue from here to solve for $u_1,u_2$? For example, you can use Cramer's rule, or you can use general substitution method.
Cramer's rule says that, the answer to a $2\times 2$ linear system of equation
$$a x_1+bx_2=r_1\\ cx_1+dx_2=r_2$$
is given by
$$x_1=\frac{\det{\begin{pmatrix}r_1&b\\r_2&d\end{pmatrix}}}{\det{\begin{pmatrix}a&b\\c&d\end{pmatrix}}}, x_2=\frac{\det{\begin{pmatrix}a&r_1\\c&r_2\end{pmatrix}}}{\det{\begin{pmatrix}a&b\\c&d\end{pmatrix}}}$$
as long as the coefficient matrix is nonsingular. You can see, the denomenators are just the determinant of the coefficient matrix. The numerator is obtained by replacing the corresponding column by the right hand side. This can be generalized to $n\times n$ case.
Green's function method is very similar:
The Green's function for this problem is
$$G(t,t')=C_1(t')\sin{(2t)}+C_2(t')\cos{(2t)}, t>t'$$
The Green's function is assumed to be $0$ when $t<t'$ because of the initial condition $y(0)=y'(0)=0$.
To satisfy the continuity and discontinuity condition for $G$ and $dG/dt$ at $t=t'$, we have
$$C_1(t')\sin{(2t')}+C_2(t')\cos{(2t')}=0\\2C_1(t')\cos{(2t')}-2C_2(t')\sin{(2t')}=1$$
The $1$ on the right hand side comes from $1/p(t)$ where $p(t)$ is the coefficient of the second derivative term in the original equation. In our case this is $1$.
You can then solve for $C_1(t')$ and $C_2(t')$ to get $G(t,t')$.
Finally the particular solution is given by
$$y_p(t)=\int^t_0 G(t,t')f(t')dt'$$