Introduction to Green's Functions
Dr. Jack Wagner, Fordham University
<ajawagner@fordham.edu> copyright 2012
. Examine the general linear, first order, non-homogenous equation, and its homogeneous counterpart.
In order to find a solution to the non-homogeneous equation we first look for a solution to the homogeneous one.
With Maple, we calculate.
>
|
de:=p(x)*diff(y(x),x)+q(x)*y(x)=0;
|
| (1) |
>
|
h_sol:=dsolve(de,y(x));
|
| (2) |
Here we have the solution to the first order homogeneous equation. Note that Maple precedes the constant of integration, _C1, with an underscore. A particular solution to the non-homogeneous equation can be written as a product of h_sol and some other function of x. We will use this idea to solve the non-homogeneous equation. Let s(x) be the unknown function which multiplies the solution to the homogeneous equation. We substitute the product for y(x) in the non-homogeneous equation.
| (3) |
>
|
De:=subs(y(x)=s(x)*rhs(h_sol),De);
|
| (4) |
Now solve for s(x).
>
|
s_sol:=dsolve(De,s(x));
|
| (5) |
This is the function which multiplies the solution to the homogeneous equation to produce a particular solution of the non-homogeneous equation. Because we have already evaluated the homogeneous equation solution, we replace its variable with a "dummy" variable in order to avoid confusion with the variable with respect to which we are yet to integrate.
>
|
h_sol:=subs(x=s,h_sol);
|
| (6) |
Now let's have a look at our solution
>
|
expand(rhs(h_sol)*rhs(s_sol));
|
| (7) |
What previously appeared as two separate constants of integration have now merged into one as they should. Now recollect the solution to the homogeneous equation, , and define:
>
|
G[s,x]:=exp(-Int(q(s)/p(s),s))/(exp(-Int(q(x)/p(x),x))*p(x));
|
| (8) |
Note that a particular solution of the non-homogeneous equation may be written as:
= =
A differential equation such as the general linear first order differential equation may be regarded as the operation of a linear operator, L= on the solution function, y(x). . The Green's function is then a kind of inverse of L. y(x)=
In Maple it looks like this.
>
|
part_sol:=Int(G[s,x]*f(x),x);
|
| (9) |
Once we know the Green's function for a differential operator L, we may solve the equation for any function on the right side by substitution in the above expression.
Ex. 1
Find the general solution of
>
|
De:=sin(x)*diff(y(x),x)+cos(x)*y(x)=1;
|
| (10) |
We will now apply the Green's function machinery to this equation. First, recollect the definition of the Green's function for first order equations.
>
|
G[s,x]:=exp(-Int(q(s)/p(s),s))/(exp(-Int(q(x)/p(x),x))*p(x));
|
| (11) |
Now define p and q for our particular problem.
>
|
PQ:={p(x)=sin(x),p(s)=sin(s),q(x)=cos(x),q(s)=cos(s)};
|
| (12) |
>
|
G[s,x]:=subs(PQ,G[s,x]);
|
| (13) |
Find
>
|
p_sol:=Int(G[s,x]*1,x);
|
| (14) |
| (15) |
Replace the "dummy" variable with the independent variable.
| (16) |
Recall the solution to the homogeneous equation.
>
|
h_sol := _C1*exp(Int(-q(x)/p(x),x));
|
| (17) |
| (18) |
| (19) |
The general solution is the sum of the homogeneous and any particular solution.
>
|
g_sol:=simplify(h_sol+p_sol);
|
| (20) |
If one were to do this with any frequency it would pay to define a procedure that creates the appropriate Green's function.
>
|
G:=proc(p::algebraic,q::algebraic)
local px,qx,ps,qs,Gxs: qx:=q: px:=p: ps:=subs(x=s,p): qs:=subs(x=s,q):
Gxs:=exp(-Int(qs/ps,s))/(exp(-Int(qx/px,x))*px):
end proc:
|
Ex. 2
We can then use the previously defined procedure (assuming it has been appropriately saved).
>
|
de:=x^2*diff(y(x),x)+x*y(x)=sin(x);
|
| (21) |
| (22) |
>
|
p_sol:=int(G*sin(x),x);
|
| (23) |
| (24) |
>
|
p_sol:=subs(s=x,p_sol);
|
| (25) |
The solution to the homogeneous equation is conveniently found in the numerator of the Green's function.
| (26) |
| (27) |
>
|
h_sol:=subs(s=x,h_sol);
|
| (28) |
>
|
g_sol:=simplify(h_sol+p_sol);
|
| (29) |
We have gone to an immense amount of trouble to end up with the same answer that we could have obtained with a very simple Maple function.
| (30) |
The point, of course, is not the answer but the introduction to Green's functions and the manner in which they are used. The importance of this method and the theory that surrounds it can hardly be overstated.
For something a bit more complcated consider the second order linear differential equation and its homogeneous counterpart.
To find the general solution we again start with the homogeneous equation.
>
|
eq1:=a[2](t)*Diff(y(t),t$2)+a[1](t)*Diff(y(t),t)+a[0](t)*y(t)=0;
|
| (31) |
Now we need solutions to the homogeneous equation, (t) and (t).
A particular solution of the non-homogeneous equation can be expressed as:
for independent functions, .
>
|
eq2:=y[p](t)=u[1](t)*y[1](t)+u[2](t)*y[2](t);
|
| (32) |
Compute the first derivative of .
, t) = (diff(u[1](t), t))*y[1](t)+u[1](t)*(diff(y[1](t), t))+(diff(u[2](t), t))*y[2](t)+u[2](t)*(diff(y[2](t), t))](/view.aspx?SI=136531/441273/c757cdfedfffc54a914eba0d0568cfdc.gif)
| (33) |
In addition to the conditions on and expressed in eq2, we may place a second condition, i.e.
>
|
eq4:=0=diff(u[1](t),t)*y[1](t)+diff(u[2](t),t)*y[2](t);
|
| (34) |
This second condition yields.
| (35) |
Substitute this expression for into the general non-homogeneous second order equation.
>
|
eq6:=a[2](t)*Diff(rhs(eq5),t)+a[1](t)*rhs(eq5)+a[0](t)*rhs(eq2)=f(t);
|
*(Diff(u[1](t)*(diff(y[1](t), t))+u[2](t)*(diff(y[2](t), t)), t))+a[1](t)*(u[1](t)*(diff(y[1](t), t))+u[2](t)*(diff(y[2](t), t)))+a[0](t)*(u[1](t)*y[1](t)+u[2](t)*y[2](t)) = f(t)](/view.aspx?SI=136531/441273/b10b0db0051346133dd28e8a2063a4be.gif)
| (36) |
*((diff(u[1](t), t))*(diff(y[1](t), t))+u[1](t)*(diff(diff(y[1](t), t), t))+(diff(u[2](t), t))*(diff(y[2](t), t))+u[2](t)*(diff(diff(y[2](t), t), t)))+a[1](t)*(u[1](t)*(diff(y[1](t), t))+u[2](t)*(diff(y[2](t), t)))+a[0](t)*(u[1](t)*y[1](t)+u[2](t)*y[2](t)) = f(t)](/view.aspx?SI=136531/441273/f1f5c6a1b48d49b8aa330aac3294c93c.gif)
| (37) |
Because and are both solutions of the homogeneous equation, we may write:
>
|
eq8a:=u[1](t)*subs(y(t)=y[1](t),eq1);
|
| (38) |
>
|
eq8b:=u[2](t)*subs(y(t)=y[2](t),eq1);
|
| (39) |
>
|
eq9:=simplify(eq7-eq8a-eq8b);
|
| (40) |
Recall the second condition on and .
| (41) |
solve eq9 and eq4 for and .
>
|
sol:=solve({eq9,eq4},{diff(u[1](t),t),diff(u[2](t),t)});
|
, t) = f(t)*y[2](t)/(a[2](t)*(y[2](t)*(diff(y[1](t), t))-(diff(y[2](t), t))*y[1](t))), diff(u[2](t), t) = -y[1](t)*f(t)/(a[2](t)*(y[2](t)*(diff(y[1](t), t))-(diff(y[2](t), t))*y[1](t)))}](/view.aspx?SI=136531/441273/6055940a667eeb8b2912bb78de4a4291.gif)
| (42) |
Now observe that in the denominator of each solution there is the determinant of the Wronskian.
Wronskian
>
|
with(VectorCalculus):with(LinearAlgebra):
|
>
|
Wronskian([y[1](t),y[2](t)],t);
|
| (43) |
| (44) |
As before we are going to need a "dummy" variable.
>
|
U[1]:=subs(t=s,Int(rhs(sol[1]),t));
|
| (45) |
>
|
U[2]:=subs(t=s,Int(rhs(sol[2]),t));
|
| (46) |
>
|
y[p](t):=subs({u[1](t)=U[1],u[2](t)=U[2]},rhs(eq2));
|
/(a[2](s)*(y[2](s)*(diff(y[1](s), s))-(diff(y[2](s), s))*y[1](s))), s))*y[1](t)+(Int(-y[1](s)*f(s)/(a[2](s)*(y[2](s)*(diff(y[1](s), s))-(diff(y[2](s), s))*y[1](s))), s))*y[2](t)](/view.aspx?SI=136531/441273/c319aaa4ddc01fc66070c63f8d3f53ff.gif)
| (47) |
>
|
y[p](t):=combine(y[p](t));
|
*y[1](s)*f(s)/(a[2](s)*(y[2](s)*(diff(y[1](s), s))-(diff(y[2](s), s))*y[1](s)))+y[1](t)*f(s)*y[2](s)/(a[2](s)*(y[2](s)*(diff(y[1](s), s))-(diff(y[2](s), s))*y[1](s))), s)](/view.aspx?SI=136531/441273/07edf1e165ee7ea51257855009ec9297.gif)
| (48) |
Now define the Green's function.
| |
>
|
G[s,t]:=-y[1](t)*y[2](s)/a[2](s)/(diff(y[2](s),s)*y[1](s)-y[2](s)*diff(y[1](s),s))+y[2](t)*y[1](s)/a[1](s)/(diff(y[2](s),s)*y[1](s)-y[2](s)*diff(y[1](s),s));
|
*y[2](s)/(a[2](s)*((diff(y[2](s), s))*y[1](s)-y[2](s)*(diff(y[1](s), s))))+y[2](t)*y[1](s)/(a[1](s)*((diff(y[2](s), s))*y[1](s)-y[2](s)*(diff(y[1](s), s))))](/view.aspx?SI=136531/441273/a43e96de60eabfa0c593a9b97b23de28.gif)
| (49) |
Having found the Green's function we may solve the non-homogeneous equation for any function on the right hand side.
>
|
y[p](t):=Int(expand(G[s,t]*f(s)),s);
|
*y[2](s)/(a[2](s)*((diff(y[2](s), s))*y[1](s)-y[2](s)*(diff(y[1](s), s))))+f(s)*y[2](t)*y[1](s)/(a[1](s)*((diff(y[2](s), s))*y[1](s)-y[2](s)*(diff(y[1](s), s)))), s)](/view.aspx?SI=136531/441273/6eb4c1e68ebfdb7293ff955624f28460.gif)
| (50) |
>
|
y(t):=y[p](t)+c[1]*y[1](t)+c[2]*y[2](t);
|
*y[2](s)/(a[2](s)*((diff(y[2](s), s))*y[1](s)-y[2](s)*(diff(y[1](s), s))))+f(s)*y[2](t)*y[1](s)/(a[1](s)*((diff(y[2](s), s))*y[1](s)-y[2](s)*(diff(y[1](s), s)))), s)+c[1]*y[1](t)+c[2]*y[2](t)](/view.aspx?SI=136531/441273/915408235c179785a29ce16661861b7d.gif)
| (51) |
Ex. 3
Find the general solution to:
>
|
restart: with(VectorCalculus): with(LinearAlgebra):
|
>
|
eq1:=t^2*Diff(y(t),`$`(t,2))+t*Diff(y(t),t)-y(t) = t;
|
| (52) |
>
|
eq2:=t^2*Diff(y(t),`$`(t,2))+t*Diff(y(t),t)-y(t) =0;
|
| (53) |
The solution will be a polynomial of low degree.
>
|
subs(y(t)=_C1*t+_C2*t^2+_C3*t^3,eq2);
|

| (54) |
| (55) |
and must be zero and is indeterminate.
>
|
subs(y(t)=_C4/t+_C5/t^2+_C6/t^3,eq2);
|

| (56) |
| (57) |
and must be zero and is indeterminate.
>
|
y[1](t):=_C1*t; y[2](t):=_C4/t;
|
| (58) |
>
|
y[1](s):=subs(t=s,y[1](t)); y[2](s):=subs(t=s,y[2](t));
|
| (59) |
macro
>
|
macro(W=Determinant(Wronskian([y[1](s),y[2](s)],s))):
|
| (60) |
Define .
>
|
G[s,t]:=-y[1](t)*y[2](s)/(a[2]*W)+y[2](t)*y[1](s)/(a[2]*W);
|
| (61) |
The particular solution is:
>
|
y[p](t):=Int(G[s,t]*s,s);
|
| (62) |
| (63) |
Check the solution.
>
|
y[p](t):=subs(s=t,y[p](t));
|
| (64) |
>
|
subs(y(t)=y[p](t),eq1);
|
| (65) |
| (66) |
| (67) |
>
|
gen_sol:=y[p](t)+y[1](t)+y[2](t);
|
| (68) |
Ex. 4
Now it is a simple matter to obtain solutions for a whole family of equations with varying "impulse" terms. Let k vary from 1 to 5.
>
|
for k from 1 to 5 do
y||k:=Int(G[s,t]*cos(s)^k,s):
y||k:=value(%):od:
for k from 1 to 5 do
y||k:=subs(s=t,y||k); od;
|
For convenience in making a comparison we will set and equal to one.
| (70) |
The general solution to the original equation is then, g+yk.
>
|
plot([g+y1,g+y2,g+y3,g+y4,g+y5],t=0..5,y=-3..10,color=[red,blue,green,black,gold]);
|
Ex. 5
>
|
for k from 1 to 5 do
y||k:=Int(G[s,t]*k*exp(k*s),s):
y||k:=value(%):od:
for k from 1 to 5 do
y||k:=subs(s=t,y||k); od;
|
Check a typical solution.
>
|
eqa:=subs(y(t)=y5,lhs(eq1));
|

| (72) |

| (73) |
| (74) |
Ei
complexplot
>
|
plots[complexplot]([g+y1,g+y2,g+y3,g+y4,g+y5],t=0..0.1,view=[0..1000,0..1]);
|
>
|
|
>
|
|
|