Given that $y=\frac{1}{2} e^{2 x}+\left(x-\frac{1}{3}\right) e^{x}$ is a special solution of the differential equation $y^{\prime \prime}+a y^{\prime}+b y=c e^{x}$ (a, b, c are constants), I want to find the value of a, b, c.

y[x_] := 1/2 E^(2 x) + (x - 1/3) E^x
SolveAlways[(D[#, {x, 2}] + a*D[#, x] + b*# == c*E^x) &@y[x], x]

But the above code can't solve this problem (the answer is a=-3,b=2,c=-1). How can I use function SolveAlways to solve this problem?


1 Answer 1


From the documentation for SolveAlways:

SolveAlways works primarily with linear and polynomial equations.

So let's make it linear! There are three linearly independent functions in here, the constant function, $x$, and $e^x$, so let's set the exponential function to y:

y[x_] = 1/2 E^(2 x) + (x - 1/3) E^x;
(D[#, {x, 2}] + a*D[#, x] + b*# == c*E^x) &@y[x] // Simplify;
SolveAlways[% /. Exp[x] -> y, {x, y}];
(* {{a -> -3, b -> 2, c -> -1}} *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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