Example 6: Find a particular solution of
.
Solution: Since a linear combination of
and
is of the form
we have
> diff(a*x*sin(x)+b*(sin(x)-x*cos(x)),x,x)+a*x*sin(x)+b*(sin(x)-x*cos(x))-x*sin(x);
> p:=unapply(%,x);
> solve({p(0)=0,p(1)=0,p(2)=0},{a,b});solve({p(0)=0,p(1)=0,p(2)=0},{a,b});
No solution. Next, we try a particular solution of the form
.
> diff(x*(a*x*sin(x)+b*(sin(x)-x*cos(x))),x,x)+x*(a*x*sin(x)+b*(sin(x)-x*cos(x)))-x*sin(x);
> p:=unapply(%,x);
> solve({p(0)=0,p(1)=0,p(2)=0},{a,b});
Hence
.