# How do you write a differential operator as a matrix?

How do you write a differential operator as a matrix? I'm very confused. Could someone please use examples to help me understand? Preferably with first and second-order linear differentiation.

It will depend somewhat on the functions you want the operator to work on, but the general scheme is the same.

First, you need to pick some basis for the functions your differential operator is going to work on. If we look to the vector space of quadratics over $\mathbb{R}$, we could have the basis $\{1,x,x^2\}$

Now a linear map is completely determined by what it does to the basis elements. If we call the differential operator $D$, then of course $D(1)=0,\quad D(x)=1, \quad D(x^2) = 2x$.

So we can encode this into a matrix:

$$D= \left( \begin{array}{ccc} 0 & 1 & 0 \\ 0 & 0 & 2 \\ 0 & 0 & 0 \end{array} \right)$$

The columns of this matrix are the images of the basis vectors after applying $D$.

Second-order derivatives are just the derivative of the derivative, i.e., applying the operator $D$ twice. So the matrix $D^2$ will represent the linear map of a function to its second derivative.

In this answer: https://math.stackexchange.com/a/943212/87896 there is another example, and applying it to solve an integral.

• You are welcome. – FireGarden Nov 3 '14 at 0:04
• I am wondering if there is actually any meanings for the column space of $D$? – Shing Oct 5 '18 at 10:03
• If you multiplied the infinite-length version of this by the vector with components $1/n!$, would it return the same vector? Because this vector would represent $e^x$ in this vector space, which of course has itself as a derivative – Max Coplan Oct 24 '18 at 13:43
• @Shing Yeah, it's the space of polynomials that are integrable within the chosen space. In $\mathbb{R}^\infty$, it's just the space of all polynomials. – Abhimanyu Pallavi Sudhir Nov 22 '18 at 16:27