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