I sought for this really long in the internet but didn't happen to find a general solution. So here is the equation:

$y' = y + x\,\cos(2\,x)$

I know that for the particular solution $y_p$ following assumption is made:

$y_p = (a_0+a_1\,x)\,\sin(2\,x)+(b_0+b_1\,x)\,\cos(2\,x)$

so that

$\begin{align} {y_p}' &= a_1\,\sin(2\,x)+(a_0+a_1\,x)\,2\,\cos(2\,x)+ b_1\,\cos(2\,x)-(b_0+b_1\,x)\,2\,\sin(2\,x) \\ &=y + x\,\cos(2\,x) = {y_p}' \end{align}$

But I don't know at all how to determine $a_1, a_0, b_1, b_0$

I could also just solve $y = C\,e^{x} +e^{x}\,\int{\frac{\cos(2\,x)}{e^x}}\mathrm{d}x$ thanks to another answer here, but how to do it generally?

  • $\begingroup$ I mean the computation that I quitted halfway. So solving it explicitly for the constants in order to understand It generally would be great. $\endgroup$
    – Leon
    Jan 2, 2021 at 17:25
  • 1
    $\begingroup$ Plug in $y_p$ for $y$ on the r.h.s. and group like terms and set them equal. $\endgroup$
    – IanJ
    Jan 2, 2021 at 17:44
  • 1
    $\begingroup$ The equation has to be true for all $x$, so you have to set the coefficients of the functions equal to each other on both sides, i.e. the coefficent of $x\cos x$ on the left equals the coefficient of $x\cos x$ on the right and so on. $\endgroup$ Jan 2, 2021 at 17:45

1 Answer 1


Grouping by $sin(2x)$ gives the equation:

$$a_1 - 2b_0 = a_0$$

Grouping by $x sin(2x)$:

$$-2b_1 = a_1$$

Grouping by $cos(2x)$:

$$2a_0 + b_1 = b_0$$

Grouping by $x cos(2x)$: $$2a_1 = b_1 + 1$$

Solve and you get $b_1 = -1/5$, $a_1 = 2/5$, $a_0 = 4/25$, $b_0 = 3/25$.

  • $\begingroup$ Thank you so much! $\endgroup$
    – Leon
    Jan 2, 2021 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .