# Problem with nonhomogeneous ODE

I'm trying to find the general solution for the ODE $$f''(t)+f(t)=\frac16\sin^3t,\tag{1}$$ but something keeps going wrong. I first set $x_1=f$, $x_2=x_1'$, so letting $$A=\left[\begin{array}{cc}0 & 1\\-1 & 0\end{array}\right],\quad x=\left[\begin{array}{c}x_1\\x_2\end{array}\right],\quad\text{and}\quad b=\left[\begin{array}{c}0\\\frac16\sin^3t\end{array}\right],$$ we have that $(1)$ is equivalent to the nonhomogeneous linear system $$x'=Ax+b.\tag{2}$$ Observing that $[i,-1]^T$ and $[i,1]^T$ are eigenvectors of $A$ corresponding (respectively) to the eigenvalues $i,-i$, I concluded (and confirmed) that the general solution to the system $x'=Ax$ has the form $$d_1e^{it}\left[\begin{array}{c}i\\-1\end{array}\right]+d_2e^{-it}\left[\begin{array}{c}i\\1\end{array}\right]$$ for some constants $d_1,d_2$. Equivalently, if $$\Phi=\left[\begin{array}{cc}ie^{it} & ie^{-it}\\-e^{it} & e^{-it}\end{array}\right]\quad\text{and}\quad d=\left[\begin{array}{c}d_1\\d_2\end{array}\right]$$ for some constants $d_1,d_2$, then $x=\Phi d$ is a solution to $x'=Ax$.

Now, suppose that $\hat c=[\hat c_1,\hat c_2]^T$, where $\hat c_1=\hat c_1(t),\hat c_2=\hat c_2(t)$ are differentiable functions with constant term $0$, and let $\hat x=\Phi\hat c+\Phi d$ for some constant vector $d$. Noting that $$A\Phi=\left[\begin{array}{cc}-e^{it} & e^{-it}\\-ie^{it} & -ie^{-it}\end{array}\right]=\Phi',$$ it follows that $$(\Phi\hat c)'=\Phi'\hat c+\Phi\hat c'=A\Phi\hat c+\Phi\hat c',$$ so since $A\Phi d=(\Phi d)'$ by the work done with the homogeneous system, then $$\hat x'=(\Phi\hat c)'+(\Phi d)'=A\Phi\hat c+\Phi\hat c'+A\Phi d=A\hat x+\Phi\hat c'.$$ Thus, $$\hat x'=A\hat x+b\quad\text{if and only if}\quad\Phi\hat c'=b.$$

Now, $\Phi$ is invertible, so letting $c$ be the antiderivative (with respect to $t$) of $\Phi^{-1}b$ without integration constant, we should have that $x=\Phi c+\Phi d$ is the general solution to $(2)$, and then $x_1$ would be the general solution to $(1)$, yes? If that's all good, then I'm apparently just making a calculation error when taking the antiderivative or doing the subsequent matrix operations....

Edit: Does anybody have a different, arguably better approach to take for this problem?

• Why not just use the identity $\sin^3 x = \frac{1}{4}(3 \sin x -\sin 3x)$? – Ayman Hourieh Sep 28 '12 at 21:10
• Hilariously, I did use that identity (though I didn't show it above), and I still managed to goof it up. – Cameron Buie Sep 29 '12 at 0:10

Finally managed to do it correctly (I finally tracked down the 2 errors, one of which was a simple sign drop), so I'll answer it (and accept it when I can, if nobody else answers) in order to prevent it from popping to the top of the active list in the future.

Indeed, the approach I took works just fine, and yields $$f(x)=\frac1{192}\sin(3t)+\frac1{32}\sin t-\frac t{16}\cos t+d_1e^{it}+d_2e^{-it}$$ for the general solution to $(1)$.

I wouldn't say this is a better or worse approach, but you can use the classic technique of Variation of Parameters:

Let

$$y(t) = A(t)y_1(t) + B(t)y_2(t),$$

where $y_1$ and $y_2$ are l.i. solutions of the homogeneous ode, then, supposing

$$A'(t) y_1(t) + B'(t) y_2(t) = 0,$$

substituting in the ode,

$$A'(t) y_1'(t) + B'(t) y_2'(t) = f(t),$$

wich, given that $y_1(t)y_2'(t) - y_1'(t) y_2(t) \neq 0$ can be solved for $A(t)$ and $B(t)$.

In case of initial conditions ($x=a$),

$$A(t) = -\int_a^t \frac{y_2(\xi)}{W(\xi)} f(\xi) d\xi,$$

$$B(t) = \int_a^t \frac{y_1(\xi)}{W(\xi)} f(\xi) d\xi,$$

where $W(t)$ is the Wronskian of $y_1$ and $y_2$.

In your case, $y_1(t) = \cos(t),\quad y_2(t) = \sin(t), \quad W(t) = 1$, and

$$A(x) = - \frac{1}{6} \int_0^t \sin^4(\xi) = -\frac{1}{192} \bigl(12 t - 8 \sin(2 t) + \sin(4 t)\bigr) + K_2,$$

$$B(x) = \frac{1}{6} \int_0^t \cos(\xi) \sin^3(\xi) = \frac{1}{24} sin^4(t) + K_1,$$

where $K_1$ and $K_2$ are constants. So

$$y(t) = c_1 \cos(t) + \tilde{c}_2 \sin(t) + \frac{1}{24}\sin^5(t) - \frac{1}{192} \bigl(12 t - 8 \sin(2 t) + \sin(4 t)\bigr) \cos(t),$$

wich can be simplified to

$$y(t) = c_1 \cos(t) + c_2 \sin(t) + \frac{1}{192} \sin(3 t) - \frac{1}{16} t \cos(t).$$

If, instead of initial values, you have boundary values, the constructions is a little different, but the same approach can be made (see the chapter on Green's function in Friedman's Principles and Techniques of Applied Mathematics).