# Factoring a differential equation into an operator product

Following the fundamental theorem of algebra, I can (as stated here in Sec. 1.1.4) factor an $n$th-order linear ordinary differential equation $$a_n \frac{d^n x}{dt^n} + a_{n-1} \frac{d^{n-1} x}{dt^{n-1}} +\cdots+a_1 \frac{dx}{dt}+a_0 = 0$$ into $$a_n \left( \frac{d}{dt} - r_1 \right) \left( \frac{d}{dt} - r_2 \right) \cdots \left( \frac{d}{dt} - r_n \right) x = 0 .$$

The Mathematica representation of the former is trivial, and I would represent the latter as

difOp[t, r] = (Dt[#, {t}] - r) &
an difOp[t, r1][ difOp[t, r2][x[t]] ] == 0


Is there any way to get the Mathematica kernel to connect the two, e.g. to compute the second from the first?

• If you just want to get $r_1, r_2,\cdots,r_n$ you can simply Solve $a_n x^n + a_{n-1} x^{n-1} +\cdots+a_1 x+a_0 = 0$. – xzczd Jul 18 '14 at 7:02

The differential operator in the first form can be written as

dd1[n_] := (Sum[a[k] D[#, {t, k}], {k, 0, n}]) &


and is applied for example as

dd1[x[t]]

a x[t] + a Derivative[x][t]


and

dd1 @x[t]

a x[t] + a Derivative[x][t] + a (x^\[Prime]\[Prime])[t]


In the second (product) form we would perhaps try

d2[n_] := a[n] Expand[Product[D[#, t] - r[k], {k, 0, n}]] &


d2[x[t]]

a (-r r r + r r Derivative[x][t] +
r r Derivative[x][t] + r r Derivative[x][t] -
r Derivative[x][t]^2 - r Derivative[x][t]^2 -
r Derivative[x][t]^2 + Derivative[x][t]^3)


which is not the result we want.

So let us proceed step by step.

First we refrain from using D[] immediately but replace it by the symbol d:

d2[n_] := a[n] Expand[Product[d - r[k], {k, 0, n}]]

d2

a (d^2 - d r - d r + r r)


Ok. Now in this expression we replace d^m by D[#,[t,m}] for m=1, 2, ..., n which gives us

dd2[n_] := a[n]*Expand[Product[d - r[k], {k, 1, n}]] /.
d^(m_) -> D[#1, {t, m}] /. d -> D[#1, {t, 1}] &


Notice that we need to replace the the first power of d separately because it does not match te pattern d^m_.

Applying it

dd2[x[t]]

a (r r - r Derivative[x][t] -
r Derivative[x][t] + (x^\[Prime]\[Prime])[t])


shows that it is correct.

Now the quantities r[i] are of course the roots of the equation

eq[n_] := 0 == Sum[a[k] r^k, {k, 0, n}]

eq

0 == a + r a

eq

0 == a + r a + r^2 a


These can be written explicitly thus

r[n_, k_] := Root[Sum[a[j] #1^j , {j, 0, n}] &, k]

r[5, 2]

Root[a + a #1 + a #1^2 + a #1^3 + a #1^4 + a #1^5 &, 2]


Summarizing, we have provided all contructs requested in the question.

Regards, Wolfgang

• I had thought about something like this, as an FDTD book I've got does it. Is there a name in mathematics for this type of operation, converting a differential operator to a symbol and back? I know the FDTD book references a paper in connection with this; it appears there in an analytic context (computing a vector calculus identity). Thank you. – timdewolf Jul 19 '14 at 23:49
• @timedewolf: Sorry for replying so late. I was on vacation. My answer to your question is: not that I'm aware of. I just used this bidirectional replacement in the context of this specific Problem. – Dr. Wolfgang Hintze Aug 10 '14 at 20:05