I don't really get a solution to a problem:

Problem: $y''+4y=\frac{1}{\sin(2x)}$

We calculate the general homogeneouse solution using the ansatz $y=e^{\lambda x}$

So we get:


The solution is $y(x)=A\cos(2x)+B\sin(2x)$ with $A,B \in \mathbb R$

Let $A,B$ be two functions and


such that

$$\begin{cases}A' (x)\cos(2x)+B'(x)\sin(2x)=0\\-2A'(x)\sin(2x)+2B'\cos(2x)=\frac{1}{\sin(2x)}\end{cases} \tag{1}$$

For all $x\in \mathbb R$, the matrix


Then because of (1) and (2) we get:


is invertible. So:

$$R(x)^{-1}=\frac{1}{2}\begin{pmatrix}2\cos(2x)&-2\sin(2x)\\ 2\sin(2x)&\cos(2x)\end{pmatrix}$$

Because of (1) and (2) we get:

$$\begin{cases}A'(x)=\frac{-1}{2}\\ B'(x)=\frac{\cos(2x)}{2\sin(2x)}\end{cases}$$


$$\begin{cases}A(x)=\frac{-x}{2}\\ B(x)=\frac{1}{4}\log|\sin(2x)|\end{cases}$$

so we get


Question: I do think I get the general idea of variation of constants. Basically, we are variating the constants to make our homogeneous solution space fit the inhomogenity. But I absolutely don't see what was done at (1). How did they get that?

  • $\begingroup$ Write (1) here. or use \tag{1} $\endgroup$ – Nosrati Aug 11 '18 at 14:41
  • $\begingroup$ thanks! was looking how to do that but couldn't find it :/ Wrote (1) and (2) in the text but it wasn't very good recognizable. $\endgroup$ – xotix Aug 11 '18 at 14:51
  • $\begingroup$ Related: math.stackexchange.com/questions/1215632/… $\endgroup$ – Hans Lundmark Aug 12 '18 at 10:06

$$y''+4y=\frac{1}{\sin(2x)}$$ You found the general solution of the homogeneous ODE : $$y_h''+4y_h=0 \qquad;\qquad y_h=A\cos(2x)+B\sin(2x)$$ $A$ and $B$ are constants.

Then you replace the constants by unknown functions $A(x)$ and $B(x)$ and you look for a particular solution $y_p$ of the non-homogeneous ODE , thus satisfying : $$\begin{cases} y_p''+ 4y_p=\frac{1}{\sin(2x)} \\ y_p=A(x)\cos(2x)+B(x)\sin(2x) \end{cases}$$ $\left(A(x)\cos(2x)+B(x)\sin(2x)\right)''+4\left(A(x)\cos(2x)+B(x)\sin(2x)\right)=\frac{1}{\sin(2x)} $

Note that you have two unknows $A(x)$ and $B(x)$ but only one equation. So, you are allowed to add an arbitrary relationship between $A(x)$ and $B(x)$. This will be useful later for simplification.



$$y_p''+ 4y_p=A''\cos(2x)+B''\sin(2x)-4A'\sin(2x)+4B'\cos(2x)=\frac{1}{\sin(2x)}$$



the equation becomes :


At this point, the advantage to introduce an relationship between $A(x)$ and $B(x)$ appears :

Let : $$A'\cos(2x)+B'\sin(2x)=0$$

The equation becomes much simpler : $$-2A'\sin(2x)+2B'\cos(2x)=\frac{1}{\sin(2x)}$$

So, you get the system $(1)$ of two ODEs allowing to compute $A(x)$ and $B(x)$ and then the particular solution $y_p(x)$ and the general solution $ y(x)=y_h(x)+y_p(x)$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.