Matrix representation of derivative This answer https://math.stackexchange.com/a/1003377/823264 says that we can form a matrix from a derivative given some set of functions. Given the set ${1,,^2}$ and $D = \frac{d}{dx}$ it implies that $D(1) = 0$, $D(x) = 1$, and $D(x^2)$ = $2x$
So far so good, but how do we explicitly get the matrix components $D_{nm}$ given this information? The answer just jumps into “here’s the matrix” instead of saying how. It says the columns are the images of the vectors but I don’t see how that yields each matrix component.
What’s the formula for computing $D_{nm}$ matrix entry?
 A: A little background:

*

*Suppose that $T: V\to W$ is a linear transformation from $n$-dimensional vector space $V$ to $m$-dimensional vector space $W$ over a field $\mathbf{F}$ (e.g., $\mathbf{R}$ or $\mathbf{C}$). Consider $\beta_{V}=\{v_{1},v_{2},\ldots,v_{n}\}$ be a basis for the vector space $V$ and $\beta_{W}=\{w_{1},w_{2},\ldots,w_{m}\}$  be a basis for the vector space $W$, the matrix representation for $T$ is defined by
$$[T]_{\beta_{V}\to \beta_{W}}:=\begin{bmatrix} \uparrow & \uparrow & \cdots &\uparrow &\uparrow\\ [T(v_{1})]_{\beta_{W}} & [T(v_{2})]_{\beta_{W}}&\cdots & [T(v_{n-1})]_{\beta_W} & [T(v_{n})]_{\beta_W}\\ \downarrow & \downarrow &\cdots &\downarrow & \downarrow\end{bmatrix}\in \mathbf{F}^{m\times n},$$
where $[T(v_{i})]_{\beta_W}$ is the coordinates of vector $T(v_{i})$ respect to basis $\beta_{W}$, i.e.,
$$[T(v_{i})]_{\beta_W}=\begin{bmatrix}\alpha_{1}\\ \alpha_{2}\\\vdots\\\alpha_{m} \end{bmatrix} \quad \text{iff}\quad T(v_{i})=\alpha_{1}w_{1}+\alpha_{2}w_{2}+\cdots+\alpha_{m}w_{m}$$
Now, the function $D: \mathcal{D}\to \mathcal{F}$, where $\mathcal{D}$ is the vector space consisting of all differentiable functions and $\mathcal{F}$ is the vector space of functions over the real line, definided by $D(f):=f'$ is a linear transformation, you can check that by definition of linear transformation.

In your example, consider $V=P_{2}(\mathbf{R})$ and $W=P_{2}(\mathbf{R})$ and field $\mathbf{F}=\mathbf{R}$. Also, consider the standar basis $\beta_{V}=\{1,x,x^{2}\}$ for $V$ and $\beta_{W}=\{1,x,x^{2}\}$ for $W$. Consider the differential operator $D: V\to W$ defined by $D(f)=f'$ for all $f\in V$, then
$$D(1)=0,\quad D(x)=1,\quad D(x^{2})=2x^{2},$$
then the matrix representation respect to standar basis for $D$ is given by
$$[D]_{\beta_{V}\to \beta_{W}}=\begin{bmatrix}\uparrow & \uparrow & \uparrow\\ [D(1)]_{\beta_{W}}& [D(x)]_{\beta_{W}}&[D(x^{2})]_{\beta_{W}}\\ \downarrow&\downarrow &\downarrow \end{bmatrix}\in \mathbf{R}^{3\times 3}.$$
Since
$$D(1)=0+0x+0x^{2}, \quad [D(1)]_{\beta_{W}}=\begin{bmatrix} 0\\0\\0\end{bmatrix},$$
$$D(x)=1+0x+0x^{2},\quad [D(x)]_{\beta_{W}}=\begin{bmatrix}1\\0\\0\end{bmatrix},$$
$$D(x^{2})=0+2x+0x^{2},\quad [D(x^{2})]_{\beta_{W}}=\begin{bmatrix}0\\2\\0\end{bmatrix}$$
Therefore,
$$\color{blue}{[D]=\begin{bmatrix}0&1&0\\0&0&2\\0&0&0\end{bmatrix}\in \mathbf{R}^{3\times 3}},$$
as desired.
A: Using the observation that $\frac{\mathrm{d}}{\mathrm{d}x}x^n=nx^{n-1}$, and taking $D$ to be the derivative operator over the vector space $P_n(\mathbb{R})$ of polynomials in $\mathbb{R}$ of order less than or equal to $n$, using the canonical basis $\beta = \{x^0, x^1, x^2, \dots, x^n\}$, we can see that $D$ can be expressed as a $(n+1) \times (n+1)$ matrix
$$D = \begin{bmatrix}d_{00} & d_{01} &\cdots & d_{0n}\\
d_{10} &d_{11} & \cdots &d_{1n}\\
\vdots & \vdots & \ddots & \vdots\\
d_{n0} & d_{n1} & \cdots &d_{nn} \end{bmatrix}$$
Where
$$d_{ij} = j\delta_{i(j-1)}$$
Where $\delta_{ij}$ is the Kronecker delta. This formula comes directly from $\frac{\mathrm{d}}{\mathrm{d}x}x^n=nx^{n-1}$. Can you see how?
This gives us the matrix
$$D = \begin{bmatrix}0 & 1 &0 &0 &\cdots & 0\\
0 &0 &2 &0 &\cdots &0\\
0 &0 &0 &3 &\cdots &0\\
\vdots & \vdots &\vdots &\vdots &\ddots & \vdots\\
0 & 0& 0 &0 &\cdots &n\\
0 &0 &0 &0 &\cdots &0 \end{bmatrix}$$
Which, applied to any polynomial, is indeed the derivative operator.
This can be generalized to an infinite-dimensional operator $D$ over $\mathbb{R}[x]$, the vector space of all formal power series in $x$ with coefficients in $\mathbb{R}$.
