5
$\begingroup$

This appeared on my professor's test review, and its taken me hours to, surprise surprise, get the wrong answer. Could someone help me with the method I should be using to solve this?

$y^{\prime\prime}+y=\tan x$

4 Answers 4

6

The quick rigorous method I can think of is by variation of parameters.

The solution is given by $y = y_h + y_p$ where $y_h$ is the homogeneous part of the solution and $y_p$ is the particular solution.

The solution to the homogeneous part is $y_h(x) = c_1 \cos(x) + c_2 \sin(x)$.

$y_p$ is obtained by variation of parameters as follows:

The reason for writing it as a linear combination of $\cos(x)$ and $\sin(x)$ is that these two are the linearly independent solution to the homogeneous part.

$y_p = a(x) \cos(x) + b(x) \sin(x)$ $y_p' = a'(x) \cos(x) + b'(x) \sin(x) - a(x) \sin(x) + b(x) \cos(x)$.

Set $a'(x) \cos(x) + b'(x) \sin(x) = 0$ and hence $y_p' = - a(x) \sin(x) + b(x) \cos(x)$.

$y_p'' = - a'(x) \sin(x) + b'(x) \cos(x) - a(x) \cos(x) -b(x) \sin(x) = b'(x) \cos(x) - a'(x) \sin(x) - y_p$

Hence, we have $a'(x) \cos(x) + b'(x) \sin(x) = 0$ and $- a'(x) \sin(x) + b'(x) \cos(x) = \tan(x)$.

Solve for $a(x)$ and $b(x)$ from the two equations to get $b'(x) = \sin(x)$ and $a'(x) = -\frac{\sin^2(x)}{\cos(x)}$.

From which we get $b(x) = -\cos(x)$ and $a(x) = \sin(x) + \log \left( \left| \frac{\cos(x/2) - \sin(x/2)}{\cos(x/2) + \sin(x/2)} \right| \right)$

and plug it back in and simplify to get the particular solution as

$y_p = \cos(x) \log \left( \left| \frac{\cos(x/2) - \sin(x/2)}{\cos(x/2) + \sin(x/2)} \right| \right)$

The final solution is

$y = c_1 \cos(x) + c_2 \sin(x) + \cos(x) \log \left( \left| \frac{\cos(x/2) - \sin(x/2)}{\cos(x/2) + \sin(x/2)} \right| \right)$

EDIT: Taking a cue from Aryabhata's post, the Green's function for this equation (which is nothing but a 1D Helmholtz equation with unit wavenumber) is $G(x) = -i \frac{e^{i|x|}}{2}$ and hence the particular solution is $\int G(x-y) \tan(y) dy$

  • 1
    Yep, I was able to find a'(x)=-sin(x)tan(x) and b'(x)=sin(x) and integrating for those gave me the right answer.2011-03-02
3

Read this article: http://www.sosmath.com/diffeq/second/variation/variation.html
It talks about "Variation of Parameters" which is what you need to use to solve it. A solution ends up being: $y=-\cos(x)\ln\left(\sec(x)+\tan(x)\right).$

All of this is covered in detail in the link. Also see http://en.wikipedia.org/wiki/Variation_of_parameters

3

The method below will solve equations of the form:

y'' + y = \frac{f'(x)}{\cos x}

First notice that \displaystyle (h \cos x)'' = h'' \cos x - 2 h' \sin x - h \cos x

Thus if $\displaystyle y = h \cos x$, then \displaystyle y'' + y = h'' \cos x - 2h' \sin x

Thus \displaystyle (y'' + y')\cos x = h'' \cos^2 x - 2h' \sin x \cos x = (h' \cos^2 x)'

Thus we get h' \cos^2 x = f(x) + A

And so

$y = \cos x \int (f(x) + A)\sec^2 x \ \text{d}x$

In your case, $\displaystyle f(x) = - \cos x$ and so

$y = \cos x \ \int (A - \cos x) \sec^2 x \ \text{d}x = A\sin x - \cos x \ \log (\sec x + \tan x) + B \cos x$

  • 0
    @Sivaram: Yes, but once you know it... That is the case with almost every technique I would guess :-)2011-03-02
1

If you feed d^2y/dx^2+y=tan(x) to Wolfram Alpha you get a solution.

  • 1
    @Eric: @woosh: I have a tendency to be very literal (or to take the cheap solution) But there are many ways to solve a problem. I hit the other answers with an upvote.2011-03-02