How can I get mathematica to solve the non-homogeneous differential equation with undetermined coefficients listed below?

Solve $\ y''(t)+3y'(t) = 2t^4 $, using: $\ y_p(t) = t(A_0t^4+A_1t^3+A_2t^2+A_3t+A_4) $

where $\ y_p(t) $ is a particular solution

incidentally, $\ y'(t) = A_4 + 2 A_3 t + 3 A_2 t^2 + 4 A_1 t^3 + 5 A_0 t^4 $ and $\ y''(t) = 2 A_3 + 6 A_2 t + 12 A_1 t^2 + 20 A_0 t^3 $

I'd like a solution that doesn't use DSolve because I can already solve the entire differential equation with that. I just need to see this particular part for verification of my work. Any suggestions?

  • 1
    $\begingroup$ I don't understand. Initially, you're giving us a differential equation, what's $y(t)$, an ansatz? And how are the initial conditions working here, you're giving us a) some functions where there should be points and b) the first/second derivative are not suitable initial conditions, zero-th and first are. And finally, what's wrong with DSolve? $\endgroup$
    – David
    Feb 26, 2012 at 19:47
  • $\begingroup$ ah. @David, so this question comes from a larger question. involving a non-homogenous differential equation with undetermined coefficients: $\ y''(t)+3y'(t)=2t^4 + t^2e^{-3t} + Sin(3t)$ Right now i'm focusing on the particular solution with the term $\ 2t^4 $ hence the above question. As for why I'm not using DSolve I want to check my handwritten work. $\endgroup$
    – user582
    Feb 26, 2012 at 20:30

2 Answers 2


If I understand the question correctly, you are looking for the solution of the differential equation

$$ y''(t)+3y'(t) = 2t^4 $$

in the form

$$ y(t) = t(A_0t^4+A_1t^3+A_2t^2+A_3t+A_4). $$

That is, you need to find the values of the $A_i$ constants that satisfy this equation. Please clarify if this is what you are asking.

To do this in Mathematica, we can define

y[t_] := t (t^4 Subscript[A, 0] + t^3 Subscript[A, 1] + 
            t^2 Subscript[A, 2] + t Subscript[A, 3] + Subscript[A, 4])

then use SolveAlways:

SolveAlways[y''[t] + 3 y'[t] == 2 t^4, t]

Mathematica graphics

  • $\begingroup$ Sorry about the subscripts, I copied the MathML. @franklin please consider posting in Mathematica syntax when possible. $\endgroup$
    – Szabolcs
    Feb 26, 2012 at 20:32
  • $\begingroup$ @Szablocs,that is correct. I am looking for the values of $\ A_i $ for $\ i = {0..4} $ that satisfy the equation. For further calrification, this syntax t*(t^4*Subscript[A,0]) is preferable to $\ t(t^4A_0) $ right? Thanks so much for the help. $\endgroup$
    – user582
    Feb 26, 2012 at 20:42
  • $\begingroup$ @franklin Actually A0 is preferably, for the simple reason that it is both readable and easy to paste into Mathematica. If you write something merely to explain, but it'll never need to be pasted into Mathematica, then math notation is of course more readable. $\endgroup$
    – Szabolcs
    Feb 26, 2012 at 20:47

You can make a WolframAlpha query directly from Mathematica (shortcut ==) :

Solve y''(t)+3y'(t)=2t^4

Then just click the show steps link.

  • $\begingroup$ mathematica does beautiful work when it comes to showing the steps but this isn't exactly what i was looking for @Artes $\endgroup$
    – user582
    Feb 26, 2012 at 20:46
  • $\begingroup$ @franklin Look at the last line in Show steps : "The general solution is: ..." which is what you were looking for, if you set c1=c2=0. As Szabolcs' solution works fine here you can still find my approach simpler and faster, so it can be pretty helpful for you. $\endgroup$
    – Artes
    Feb 26, 2012 at 20:57

Your Answer

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