Deterministic Variation of Parameters - Differential Equations I have been looking over the following problem
$$y'' + 4y = 4sec^2(2x)$$
We first find the complementary function and find two complex roots, $m=2i,-2i$.
I will use the particular solution
$$y_p = a\cos(2x) + b\sin(2x)$$
where $a$ and $b$ are arbitrary constants
I use $u_1$ and $u_2$ to represent functions
$$y = u_1\cos(2x) + u_2\sin(2x)$$
I then start by differentiating twice and then substituting it into the original differential
$$y' = -2u_1\sin(2x) + u_1'\cos(2x) + 2u_2\cos(x) + u_2'\sin(2x)$$
$$y''=-4u_1\cos(2x)+u_1'\sin(2x)-4u_2\sin(2x)+u_2'\cos(2x)-2u_2'\cos(2x)+u_1''\sin(2x)$$
Provided the derivatives are correct use a deterministic setup, e.g., a matrix representation
$
   u_1'=
  \left[ {\begin{array}{cc}
   \sin(2x) & 0 \\
   \cos(2x) & -4\sec^2(2x) \\
  \end{array} } \right]
$
$
   -u_2'=
  \left[ {\begin{array}{cc}
   \cos(2x) & 0 \\
   \sin(2x) & -4\sec^2(2x) \\
  \end{array} } \right]
$
$
   1 =
  \left[ {\begin{array}{cc}
   \cos(2x) & \sin(2x) \\
   -\sin(2x) & \cos(2x) \\
  \end{array} } \right]
$
I found
$$u_1' = -4\sin(2x)\sec^2(2x) = -4\tan(2x)\sec(2x)$$
$$u_2' = -4\cos(2x)\sec^2(2x) = -4\sec(2x)$$
I end up with having to integrate $u_1'$, $-u_2'$ for substitution into $y_p$ 
$$y_p = 4\sec(2x)\cos(2x) - 4\sec2x\tan2x$$
with the complementary solution 
$$y_c = c_1\cos(2x)+c_2\sin(2x)$$
I need to start using a more advanced technique, e.g., the deterministic method of finding the general solutions to variation of parameters.
 A: I'm not very familiar with the type of variation of parameters you're doing here, but it appears to be a less generalized version of the method that involves the Wronskian. The idea for the method involving the Wronskian is to use a pair of formulas that tell you what your $u_1$ and $u_2$ should be based on each linearly independent solution, the Wronskian of the solutions, the forcing term, and the leading coefficient of the ODE. It appears that your method could be useful for higher-order ODEs, since it doesn't bypass the manipulation done to obtain a nice compact formula like in the Wronskian method. 
Consider the general ODE $ay''+by'+cy=f(t)$. The first step is to find the general solution to the homogenous equation using the complementary equation/characteristic equation/auxiliary equation/etc. This should take the form $C_1 y_1+C_2 y_2$, where $y_1$ and $y_2$ are the two linearly independent solutions.
Next, you can use the following formulas for $u_1$ and $u_2$:
$\displaystyle u_1 = \int{\dfrac{-y_2 f(t)}{aW[y_1, y_2]}dt}$
$\displaystyle u_2 = \int{\dfrac{y_1 f(t)}{aW[y_1, y_2]}dt}$
Where $W[y_1, y_2]$ is the Wronskian, or the determinant of the following matrix:
$\begin{bmatrix}y_1 & y_2\\y_1' & y_2'\end{bmatrix}$
Note that the constants of integration can be disregarded.
You can use this method to solve the equation you've listed, and I invite you to try to derive the above equations using a similar method as you did in your post, just using general variables and functions instead. 
When a given ODE has complex roots for its complementary equation, it generally makes the problem slightly harder since you're no longer dealing with exponentials so computing the Wronskian and the integrals involve a bit more work.
