green function

logistic_guy

Senior Member
Joined
Apr 17, 2024
Messages
1,785
Find Green's function for the following differential equation:

d2ydx2+k2y=f(x)\displaystyle \frac{d^2y}{dx^2} + k^2y = f(x)

a<x<b\displaystyle a < x < b

Then use it to find the solution of:

d2ydx2+4y=x\displaystyle \frac{d^2y}{dx^2} + 4y = x

y(1)=5\displaystyle y(1) = 5
y(5)=1\displaystyle y(5) = 1
1<x<5\displaystyle 1 < x < 5

Solve the differential equation again with your favorite normal method. Does your answer agree with Green's function?

The son of Oscar thinks that Green's function method is too complicated. He does not understand why we use it and he thinks that to solve the problem normally is better. Explain to him why mathematicians, engineers, and scientists prefer to use Green's function to solve differential equations so that he becomes fully convinced that he was wrong. I once was like the son of Oscar before Jambo\displaystyle \text{Jambo} enlightened me with the power of Green's function!

🫰❤️💙🤏
 
Last edited:
Find Green's function for the following differential equation:

d2ydx2+k2y=f(x)\displaystyle \frac{d^2y}{dx^2} + k^2y = f(x)

a<x<b\displaystyle a < x < b

Then use it to find the solution of:

d2ydx2+4y=x\displaystyle \frac{d^2y}{dx^2} + 4y = x

y(1)=5\displaystyle y(1) = 5
y(5)=1\displaystyle y(5) = 1
1<x<5\displaystyle 1 < x < 5

Solve the differential equation again with your favorite normal method. Does your answer agree with Green's function?

The son of Oscar thinks that Green's function method is too complicated. He does not understand why we use it and he thinks that to solve the problem normally is better. Explain to him why mathematicians, engineers, and scientists prefer to use Green's function to solve differential equations so that he becomes fully convinced that he was wrong. I once was like the son of Oscar before Jambo\displaystyle \text{Jambo} enlightened me with the power of Green's function!

🫰❤️💙🤏
Please show us what you have tried and exactly where you are stuck.

Please follow the rules of posting in this forum, as enunciated at:


Please share your work/thoughts about this problem
 
d2ydx2+4y=x\displaystyle \frac{d^2y}{dx^2} + 4y = x

y(1)=5\displaystyle y(1) = 5
y(5)=1\displaystyle y(5) = 1
1<x<5\displaystyle 1 < x < 5
Before we start any attempt to attack this problem, let us see what Mrs. Alpha\displaystyle \text{Mrs. Alpha} says about its solution. This is a good strategy so that in later stages of our solution we have something to compare with and see if our solution is correct.

Let us have a taste of how the solution will look like.

😍

y(x)=csc2[ xsin8+sin(22x)+19sin(102x) ]8(cos2+cos6)\displaystyle y(x) = \frac{\csc 2[ \ x\sin 8 + \sin(2 - 2x) + 19\sin(10 - 2x) \ ]}{8(\cos 2 + \cos 6)}
 
💙

g(x,s)={y1(s)y2(x)W(s)asxy1(x)y2(s)W(s)xsb\large g(x,s) =\begin{cases} \frac{y_1(s)y_2(x)}{W(s)} & a \leq s \leq x\\[2ex] \frac{y_1(x)y_2(s)}{W(s)} & x \leq s \leq b\end{cases}
 
💚

y1(x)=sink(xa)\displaystyle y_1(x) = \sin k(x - a)

Then,

g(x,s)={sink(sa)y2(x)W(s)asxsink(xa)y2(s)W(s)xsb\large g(x,s) =\begin{cases} \frac{\sin k(s - a)y_2(x)}{W(s)} & a \leq s \leq x\\[2ex] \frac{\sin k(x - a)y_2(s)}{W(s)} & x \leq s \leq b\end{cases}
 
🤎

y2(x)=sink(bx)\displaystyle y_2(x) = \sin k(b - x)

Then,

g(x,s)={sink(sa)sink(bx)W(s)asxsink(xa)sink(bs)W(s)xsb\large g(x,s) =\begin{cases} \frac{\sin k(s - a)\sin k(b - x)}{W(s)} & a \leq s \leq x\\[2ex] \frac{\sin k(x - a)\sin k(b - s)}{W(s)} & x \leq s \leq b\end{cases}
 
🧡

W(x)=W(y1,y2)=sink(xa)sink(bx)kcosk(xa)kcosk(bx)W(x) = W(y_1,y_2) = \left|\begin{array}{ccc}\sin k(x-a) & \sin k(b-x)\\[10pt]k\cos k(x-a) & -k\cos k(b-x)\end{array}\right|


=sink(xa)kcosk(bx)sink(bx)kcosk(xa)\displaystyle = -\sin k(x-a)k\cos k(b-x) - \sin k(b-x)k\cos k(x-a)


=ksink(ba)\displaystyle = -k\sin k(b-a)


This gives:

g(x,s)={sink(sa)sink(bx)ksink(ba)asxsink(xa)sink(bs)ksink(ba)xsb\large g(x,s) =\begin{cases} -\frac{\sin k(s - a)\sin k(b - x)}{k\sin k(b-a)} & a \leq s \leq x\\[2ex] -\frac{\sin k(x - a)\sin k(b - s)}{k\sin k(b-a)} & x \leq s \leq b\end{cases}
 
g(x,s)={sink(sa)sink(bx)ksink(ba)asxsink(xa)sink(bs)ksink(ba)xsb\large g(x,s) =\begin{cases} -\frac{\sin k(s - a)\sin k(b - x)}{k\sin k(b-a)} & a \leq s \leq x\\[2ex] -\frac{\sin k(x - a)\sin k(b - s)}{k\sin k(b-a)} & x \leq s \leq b\end{cases}
For the sake of completeness, I need to say this.

Some authors prefer this notation (Russians)\displaystyle (\bold{Russians}):

asx\displaystyle a \leq s \leq x
xsb\displaystyle x \leq s \leq b

Some other authors prefer this notation:

as<x\displaystyle a \leq s < x
x<sb\displaystyle x < s \leq b

I use both of them interchangeably. Therefore, don't get confused as they are equivalent for our purpose!

😑😑
 
d2ydx2+4y=x\displaystyle \frac{d^2y}{dx^2} + 4y = x

y(1)=5\displaystyle y(1) = 5
y(5)=1\displaystyle y(5) = 1
1<x<5\displaystyle 1 < x < 5
Now I will explain how to use Green's function to solve this problem!

We know that when the differential equation is non-homogeneous, it has two solutions. One solution, yh(x)\displaystyle y_h(x), (or yc(x)\displaystyle y_c(x) sometimes called the complementary solution), comes from the homogeneous differential equation and the other is the particular solution yp(x)\displaystyle y_p(x) which comes from the nonhomogeneous differential equation.

Green function is built into the particular solution. That is:

yp(x)=15s g(x,s) ds\displaystyle y_p(x) = \int_{1}^{5} s \ g(x,s) \ ds

where g(x,s)\displaystyle g(x,s) is the green function and for this problem is defined as:

g(x,s)={sin2(s1)sin2(5x)2sin2(51)1sxsin2(x1)sin2(5s)2sin2(51)xs5\large g(x,s) =\begin{cases} -\frac{\sin 2(s - 1)\sin 2(5 - x)}{2\sin 2(5-1)} & 1 \leq s \leq x\\[2ex] -\frac{\sin 2(x - 1)\sin 2(5 - s)}{2\sin 2(5-1)} & x \leq s \leq 5\end{cases}

Or

g(x,s)={sin2(s1)sin2(5x)2sin81sxsin2(x1)sin2(5s)2sin8xs5\large g(x,s) =\begin{cases} -\frac{\sin 2(s - 1)\sin 2(5 - x)}{2\sin 8} & 1 \leq s \leq x\\[2ex] -\frac{\sin 2(x - 1)\sin 2(5 - s)}{2\sin 8} & x \leq s \leq 5\end{cases}

Substitute Green's function in the particular solution.

yp(x)=sin2(5x)2sin81xssin2(s1) dssin2(x1)2sin8x5ssin2(5s) ds\displaystyle y_p(x) = -\frac{\sin 2(5 - x)}{2\sin 8}\int_{1}^{x} s \sin 2(s - 1) \ ds - \frac{\sin 2(x - 1)}{2\sin 8}\int_{x}^{5} s \sin 2(5 - s) \ ds

Solving these integrals gives:

yp(x)=sin2(5x)2sin8[sin2(x1)2xcos2(x1)+24]sin2(x1)2sin8[sin2(x5)2xcos2(x5)+104]\displaystyle y_p(x) = -\frac{\sin 2(5 - x)}{2\sin 8}\bigg[\frac{\sin 2(x - 1) - 2x\cos 2(x - 1) + 2}{4}\bigg] - \frac{\sin 2(x - 1)}{2\sin 8}\bigg[\frac{\sin 2(x - 5) - 2x\cos 2(x - 5) + 10}{4}\bigg]

Or

yp(x)=[sin2(x1)sin2(5x)2xcos2(x1)sin2(5x)+2sin2(5x)8sin8][sin2(x5)sin2(x1)2xcos2(x5)sin2(x1)+10sin2(x1)8sin8]\displaystyle y_p(x) = -\bigg[\frac{\sin 2(x - 1)\sin 2(5 - x) - 2x\cos 2(x - 1)\sin 2(5 - x) + 2\sin 2(5 - x)}{8\sin 8}\bigg] - \bigg[\frac{\sin 2(x - 5)\sin 2(x - 1) - 2x\cos 2(x - 5)\sin 2(x - 1) + 10\sin 2(x - 1)}{8\sin 8}\bigg]

Or

yp(x)=[2xcos2(x1)sin2(5x)2sin2(5x)8sin8]+[2xcos2(x5)sin2(x1)10sin2(x1)8sin8]\displaystyle y_p(x) = \bigg[\frac{2x\cos 2(x - 1)\sin 2(5 - x) - 2\sin 2(5 - x)}{8\sin 8}\bigg] + \bigg[\frac{2x\cos 2(x - 5)\sin 2(x - 1) - 10\sin 2(x - 1)}{8\sin 8}\bigg]

Or

yp(x)=[2xsin82sin2(5x)10sin2(x1)8sin8]\displaystyle y_p(x) = \bigg[\frac{2x\sin 8 - 2\sin 2(5 - x) - 10\sin 2(x - 1)}{8\sin 8}\bigg]

Or

yp(x)=[xsin8sin2(5x)5sin2(x1)4sin8]\displaystyle y_p(x) = \bigg[\frac{x\sin 8 - \sin 2(5 - x) - 5\sin 2(x - 1)}{4\sin 8}\bigg]

Or

yp(x)=[xsin2(5x)csc85sin2(x1)csc84]\displaystyle y_p(x) = \bigg[\frac{x - \sin 2(5 - x)\csc 8 - 5\sin 2(x - 1)\csc 8}{4}\bigg]

The homogeneous solution is\displaystyle \textcolor{red}{\bold{The \ homogeneous \ solution \ is}}:

yh(x)=c1cos2x+c2sin2x\displaystyle y_h(x) = c_1\cos 2x + c_2\sin 2x

Applying the boundary conditions y(1)=5,y(5)=1\displaystyle y(1) = 5, y(5) = 1 give us:

yh(x)=sin2(x1)+5sin2(5x)2(cos2+cos6)sin2\displaystyle y_h(x) = \frac{\sin2(x - 1) + 5 \sin 2(5 - x)}{2(\cos 2 + \cos 6)\sin 2}

d2ydx2+4y=x\displaystyle \frac{d^2y}{dx^2} + 4y = x

y(1)=5\displaystyle y(1) = 5
y(5)=1\displaystyle y(5) = 1
1<x<5\displaystyle 1 < x < 5
The solution to the differential equation above is:

y(x)=yh(x)+yp(x)=sin2(x1)+5sin2(5x)2(cos2+cos6)sin2+[xsin2(5x)csc85sin2(x1)csc84]\displaystyle y(x) = y_h(x) + y_p(x) = \frac{\sin2(x - 1) + 5 \sin 2(5 - x)}{2(\cos 2 + \cos 6)\sin 2} + \bigg[\frac{x - \sin 2(5 - x)\csc 8 - 5\sin 2(x - 1)\csc 8}{4}\bigg]

Simplify the expression above by Wolfram Alpha. And you'll get:

y(x)=csc2[xsin8+sin(22x)+19sin(102x)]8(cos2+cos6)\displaystyle y(x) = \frac{\csc 2\bigg[x\sin 8 + \sin(2-2x) + 19\sin(10 - 2x)\bigg]}{8(\cos 2 + \cos 6)}

which matches post #4\displaystyle \# 4.

Here is a screen shot.

green.png

Now is the most important question which is why do we use this method when it is very complicated? Yes, I agree that it is very difficult but the main goal is you spend a lot of time to solve one differential equation but then you use its solution to solve 1000\displaystyle 1000 differential equations in a few minutes using the same green function but different force functions and different boundary conditions. And you don't have to simplify as we did in this problem!

What do I mean by that?

Now we can solve all of these differential equations in less than 5 minutes!

y(x)+10y(x)=tanx\displaystyle y''(x) + 10y(x) = \tan x
y(x)+64y(x)=xex\displaystyle y''(x) + 64y(x) = xe^x
y(x)+7y(x)=lnx\displaystyle y''(x) + 7y(x) = \ln x
y(x)+44y(x)=tanx+sinx\displaystyle y''(x) + 44y(x) = \tan x + \sin x
y(x)+y(x)=x2x+1\displaystyle y''(x) + y(x) = x^2 - x + 1
y(x)+16y(x)=sin5x+cosx14x3\displaystyle y''(x) + 16y(x) = \sin 5x + \cos x - 14x^3
y(x)+k2y(x)=f(x)\displaystyle y''(x) + k^2y(x) = f(x)
And the list goes on....!

In simple words, the solution is always:

y(x)=c1coskx+c2sinkx+abf(s)g(x,s) ds\large y(x) = c_1\cos kx + c_2\sin kx + \int_{a}^{b}f(s)g(x,s) \ ds

And just remember that once you obtain the Green's function for any second order differential equation, you don't have to solve the integral by hand as I did! (This will save you a lot of time but you lose the enjoyment in return!)

😏😏I hate mathematics.\displaystyle {\color{green}\huge \bold{I \ hate \ mathematics.}}
 
Last edited:
d2ydx2+4y=x\displaystyle \frac{d^2y}{dx^2} + 4y = x

y(1)=5\displaystyle y(1) = 5
y(5)=1\displaystyle y(5) = 1
1<x<5\displaystyle 1 < x < 5
Solve the differential equation again with your favorite normal method.
Now we solve the differential equation by the normal usual way (the method of undetermined coefficients).
We know that the solution to the homogeneous version of that equation is:

yh(x)=c1cos2x+c2sin2x\displaystyle y_h(x) = c_1\cos 2x + c_2\sin 2x

And our guess of the particular solution is:

yp(x)=Ax+B\displaystyle y_p(x) = Ax + B

Now we differentiate it twice:

yp(x)=A\displaystyle y'_p(x) = A

y(x)=0\displaystyle y''(x) = 0

Substitute the result back to the non-homogeneous differential equation.

0+4(Ax+B)=x\displaystyle 0 + 4(Ax + B) = x

4Ax+4B=x\displaystyle 4Ax + 4B = x

Compare left side with right side. We see that:

A=14\displaystyle A = \frac{1}{4} and B=0\displaystyle B = 0

Then

yp(x)=14x\displaystyle y_p(x) = \frac{1}{4}x

The general solution is:

y(x)=yh(x)+yp(x)=c1cos2x+c2sin2x+14x\displaystyle y(x) = y_h(x) + y_p(x) = c_1\cos 2x + c_2\sin 2x + \frac{1}{4}x

Apply the first boundary condition.

5=c1cos2+c2sin2+14\displaystyle 5 = c_1\cos 2 + c_2\sin 2 + \frac{1}{4}

Let us solve for c1\displaystyle c_1.

c1=5c2sin214cos2=19c24sin24cos2\displaystyle c_1 = \frac{5 - c_2\sin 2 - \frac{1}{4}}{\cos 2} = \frac{19 - c_24\sin 2}{4\cos 2}

Substitute the value back to the solution.

y(x)=[19c24sin24cos2]cos2x+c2sin2x+14x\displaystyle y(x) = \bigg[\frac{19 - c_24\sin 2}{4\cos 2}\bigg]\cos 2x + c_2\sin 2x + \frac{1}{4}x

Apply the second boundary conditions.

1=[19c24sin24cos2]cos10+c2sin10+54\displaystyle 1 = \bigg[\frac{19 - c_24\sin 2}{4\cos 2}\bigg]\cos 10 + c_2\sin 10 + \frac{5}{4}

Solve for c2\displaystyle c_2.

4cos2=19cos10c24sin2cos10+c24sin10cos2+5cos2\displaystyle 4\cos 2 = 19\cos 10 - c_24\sin 2\cos 10 + c_24\sin 10\cos 2 + 5\cos 2

4cos2=19cos10+c24sin8+5cos2\displaystyle 4\cos 2 = 19\cos 10 + c_24\sin 8 + 5\cos 2

c2=4cos219cos105cos24sin8\displaystyle c_2 = \frac{4\cos 2 - 19\cos 10 - 5\cos 2}{4\sin 8}

Substitute the result back to the differential equation solution.

y(x)=[19[4cos219cos105cos24sin8]4sin24cos2]cos2x+[4cos219cos105cos24sin8]sin2x+14x\displaystyle y(x) = \bigg[\frac{19 - \bigg[\frac{4\cos 2 - 19\cos 10 - 5\cos 2}{4\sin 8}\bigg]4\sin 2}{4\cos 2}\bigg]\cos 2x + \bigg[\frac{4\cos 2 - 19\cos 10 - 5\cos 2}{4\sin 8}\bigg]\sin 2x + \frac{1}{4}x

When you simplify this solution by WolframAlpha\displaystyle \color{orange} \bold{Wolfram Alpha}, you will get:

y(x)=xsin(8)+sin(22x)+19sin(102x)4sin(8)\displaystyle y(x) = \frac{x \sin(8) + \sin(2 - 2 x) + 19 \sin(10 - 2 x)}{4 \sin(8)}

which matches the solution below (that we have found in post #4\displaystyle 4).
y(x)=csc2[ xsin8+sin(22x)+19sin(102x) ]8(cos2+cos6)\displaystyle y(x) = \frac{\csc 2[ \ x\sin 8 + \sin(2 - 2x) + 19\sin(10 - 2x) \ ]}{8(\cos 2 + \cos 6)}
You may say that they look a little bit different! But remember:

csc28(cos2+cos6)=18(sin2cos2+sin2cos6)\displaystyle \frac{\csc 2}{8(\cos 2 + \cos 6)} = \frac{1}{8(\sin 2\cos 2 + \sin 2\cos 6)}

sinAcosB=12[sin(A+B)+sin(AB)]\displaystyle \sin A \cos B = \frac{1}{2}\bigg[\sin(A + B) + \sin(A - B)\bigg]

Then,

sin2cos2=12[sin(4)+sin(0)]=sin42\displaystyle \sin 2 \cos 2 = \frac{1}{2}\bigg[\sin(4) + \sin(0)\bigg] = \frac{\sin 4}{2}

sin2cos6=12[sin(8)+sin(4)]=sin(8)sin(4)2\displaystyle \sin 2 \cos 6 = \frac{1}{2}\bigg[\sin(8) + \sin(-4)\bigg] = \frac{\sin(8) - \sin(4)}{2}

Then,

18(sin2cos2+sin2cos6)=18[sin42+sin(8)sin(4)2]=18[sin(8)2]=14sin(8)\displaystyle \frac{1}{8(\sin 2\cos 2 + \sin 2\cos 6)} = \frac{1}{8\bigg[\frac{\sin 4}{2} + \frac{\sin(8) - \sin(4)}{2}\bigg]} = \frac{1}{8\bigg[\frac{\sin(8)}{2}\bigg]} = \frac{1}{4\sin(8)}

Does your answer agree with Green's function?
Yes, it does completely agree with Green's function solution. But less fun!🤪
 
Last edited:
Top