Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to solve the following differential equation $$y''+\frac{1}{4}y=\sin(2x)~~~y(0)=y(\pi)=0,$$ using Green's function. I have found the Green's function for the operator $y''+\frac{1}{4}$ to be $$G(x,\xi)= \sin\left(\frac{1}{2}(x-\xi)\right).$$ However, when integrating $$y(x)=\int_0^\pi \sin\left(\frac{1}{2}(x-\xi)\right) \cdot \sin(2 \xi)~d\xi =\frac{8}{15}\left(\sin(x/2)+\cos(x/2)\right)$$ which is very different from the actual answer of $$y(x)=-\frac{4}{15} \sin(2x).$$

Obviously, I am not doing something right. Where am I going wrong?

share|cite|improve this question
You mean the Green's function of $y'' + \tfrac14 y$? – Fabian Jan 23 '13 at 7:57
Also $y=\xi$ in the convolution. – Fabian Jan 23 '13 at 7:58
Note that this is not the Green's function of the problem with the given boundary conditions $y(0)=y(\pi)=0$. – Fabian Jan 23 '13 at 7:59
@Fabian: clearly I have messed up. can you help? – Paul Jan 23 '13 at 8:04
@Fabian: We speak of a Green's function of a linear differential operator, which in this case is not only the differential expression $d^2/dx^2 + 1/4$, but also the region of interest $[0,\pi]$ and the given boundary conditions. – Ron Gordon Jan 23 '13 at 10:53
up vote 0 down vote accepted

Let's start from the beginning. You want to express the problem as solving for a function $G(x,y)$ that satisfies, for $x \in [0,\pi]$

$$\frac{d}{dx^2} G(x,x') + \frac{1}{4} G(x,x') = \delta(x-x') $$

where $\delta(x-x') = 0 \, \forall \, x \ne x'$ and $\int_0^{\pi} dx' \: \delta(x-x') = 1 $. The solution you seek, $y(x)$, satisfies the boundary conditions $y(0) = y(\pi) = 0$, and may be expressed in terms of $g$ as

$$ y(x) = \int_0^{\pi} dx' \: G(x,x') \sin{2 x'} $$

To find $G$, we assume $x \ne x'$ and write down the general solution to the homogeneous equation:

$$G(x,x') = A \cos{\frac{x}{2}} + B \sin{\frac{x}{2}} $$

The boundary conditions on the solution may be expressed in terms of the relation of $x$ to $x'$. For example, the condition on $y(0)$ translates into a condition for $G(x,x') \, \forall \, x < x'$; that is, $G(0,x') = A = 0$ when $x < x'$. Similarly, the condition $y(\pi) = 0 \implies G(\pi,x') = B = 0$ when $x > x'$. We may then write

$$G(x,x') = \displaystyle \begin{cases} B \sin{\frac{x}{2}} & x < x' \\ A \cos{\frac{x}{2}} & x > x' \end{cases}$$

(This is where I think you went off the rails.) To find $A$ and $B$, we impose 2 conditions. The first is that $G(x,x')$ be continuous when $x=x'$. This leads to the relationship $A = B \tan{\frac{x}{2}}$. The second is that the derivative of $G(x,x')$ with respect to $x$ is discontinuous at $x=x'$ and satisfies

$$\lim_{\epsilon \rightarrow 0} \left [ \frac{\partial}{\partial x} G(x'+\epsilon,x') - \frac{\partial}{\partial x} G(x'-\epsilon,x') \right ] = 1$$

This relationship may be seen from integration of the differential equation defining $G$ above. Plugging in the above expression for $G(x,x')$, we get a second relation for $A$ and $B$: $A \sin{\frac{x'}{2}} + B \cos{\frac{x'}{2}} = -2$. We may solve for $A$ and $B$ and find that $A = -2 \sin{\frac{x'}{2}}$ and $B = -2 \cos{\frac{x'}{2}}$. (A little manipulation of trig identiies is needed to get this.) We may now write

$$G(x,x') = \displaystyle \begin{cases} -2 \cos{\frac{x'}{2}} \sin{\frac{x}{2}} & x < x' \\ -2 \sin{\frac{x'}{2}} \cos{\frac{x}{2}} & x > x' \end{cases}$$

We are now ready to compute the solution $y(x)$ as written above. Because of the different functional forms for $G$ about $x=x'$, we need to split the integral defining $y$ into two pieces:

$$y(x) = -2 \cos{\frac{x}{2}} \int_0^x dx' \: \sin{\frac{x'}{2}} \sin{2 x'} -2 \sin{\frac{x}{2}} \int_0^x dx' \: \cos{\frac{x'}{2}} \sin{2 x'}$$

The evaluation of these integrals is made possible through the trigonometric addition formulas $\cos{(a-b)} - \cos{(a+b)} = 2 \sin{a} \sin{b}$ and $\sin{(a+b)} + \sin{(a-b)} = 2 \sin{a} \cos{b}$. It does get a little messy, but you may verify that the solution you seek,

$$y(x) = - \frac{4}{15} \sin{2 x} $$

is the result of the evaluation of the above integrals.

share|cite|improve this answer

Note that this is not the Green's function of the problem with the given boundary conditions $y(0)=y(\pi)=0$. The general solution of the homogeneous equation $y''+\tfrac14 y=0$ is given by $\alpha \cos(x/2) + \beta \sin(x/2).$ The Green's function $G(x,\xi)$ fulfills the homogeneous equation for $x\neq \xi$ and incorporates the boundary conditions $G(0,\xi)=G(\pi,\xi)=0$, and $\partial_x G(x,\xi)|_{x=\xi^+}-\partial_x G(x,\xi)|_{x=\xi^-}=1$.

We try with the ansatz $$G(x,\xi) = \begin{cases} \alpha_1 \cos(x/2) + \beta_1 \sin(x/2), x<\xi, \\ \alpha_2 \cos(x/2) + \beta_2 \sin(x/2), x>\xi.\end{cases} $$

  • The boundary condition $G(0,\xi)=0$ implies $\alpha_1 =0$.

  • The boundary condition $G(\pi,\xi)=0$ implies $\beta_2=0$.

  • Continuity at $x=\xi$ demands $$\tag{a}\beta_1 \sin(\xi/2)=\alpha_2 \cos(\xi/2).$$

  • The requirement on the first derivative $\partial_x G(x,\xi)|_{x=\xi^+}-\partial_x G(x,\xi)|_{x=\xi^-}=1$ demands $$\frac12[-\alpha_2 \sin(\xi/2) -\beta_1 \cos(\xi/2)]=1$$ or equivalently $$\tag{b}\beta_1 \cos(\xi/2) + \alpha_2 \sin(\xi/2) =-2.$$

  • Combining (a) and (b), we obtain $$\beta_1 = -2 \cos(\xi/2) \qquad \alpha_2 =-2 \sin(\xi/2)$$ and the Green's function $$G(x,\xi) = -2\begin{cases} \cos(\xi/2)\sin(x/2), &x<\xi,\\ \sin(\xi/2) \cos(x/2), &x>\xi. \end{cases}$$

  • You obtain the solution of the inhomogeneous equation via integration $$y(x)= \int_0^\pi d\xi\,G(x,\xi)\sin(2\xi).$$

share|cite|improve this answer
Thank you Fabian. Can the Green's function be found using Fourier transforms? – Paul Jan 23 '13 at 10:07
@Paul: no, at least not directly as the system is not translationally invariant, the problem is not diagonal in Fourier space. In 1D it is usually simplest to glue the solutions of the homogenous equation together as I have dome in my anwer. – Fabian Jan 23 '13 at 11:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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