{%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %}
# Matrix representation in a vector space
## Problem
Let $\mathcal{P}_d$ be the vector space of all polynomials of dergree at most $d$. Let $\alpha = \{1, x, x^2, x^3\}$ be a basis of $\mathcal{P}_3$ and $\beta = \{1, x, x^2\}$ a basis of $\mathcal{P}_2$.
Consider the function $f: \mathcal{P}_3\rightarrow\mathcal{P}_2$ defined by $p\mapsto p' + p''$. Find a matrix $A$ such that $[f(p)]_\beta = A[p]_\alpha$ for all $p\in\mathcal{P}_3$. Here $p'$ and $p''$ are the derivative and the second derivative of $p$, respectively.
## Thought
This problem is essentially the same as [Matrix representation in $\mathbb{R}^n$](https://hackmd.io/@jephianlin/BkZ9m3FB6) plus the idea in [Matrix is a price table](https://hackmd.io/@jephianlin/Hk1K2worT).
Let us first try to understand the main equality $[f(p)]_\beta = A[p]_\alpha$. It is no doubt that the function $f$ sends $p\mapsto f(p)$, and we want to represent this mapping by a matrix $A$. However, a matrix $A$ only interacts with a vector but not a polynomial, so we have to use the vector representations instead to describe this mapping. Therefore, the equality is saying the mapping $[p]_\alpha \mapsto [f(p)]_\beta$ can be represented by $A$.
Now think about the price table. In the domain $\mathcal{P}_3$, we have four products $1$, $x$, $x^2$, and $x^3$. Then we may recover the price table by asking $f(1)$, $f(x)$, $f(x^2)$, and $f(x^3)$.
$1 \mapsto f(1) = 1' + 1'' = 0$
$x \mapsto f(x) = x' + x'' = 1$
$x^2 \mapsto f(x^2) = (x^2)' + (x^2)'' = 2x + 2$
$x^3 \mapsto f(x^3) = (x^3)' + (x^3)'' = 3x^2 + 6x$
Since in the codomain $\mathcal{P}_2$ we have the products $1$, $x$, and $x^2$. Let us rearrange everything in order.
$1 \mapsto 0 + 0x + 0x^2$
$x \mapsto 1 + 0x + 0x^2$
$x^2 \mapsto 2 + 2x + 0x^2$
$x^3 \mapsto 0 + 6x + 3x^2$
Thus, the price table is
$$
A = \begin{bmatrix}
| & ~ & ~ & | \\
[f(1)]_\beta & \cdots & \cdots & [f(x^3)]_\beta \\
| & ~ & ~ & | \\
\end{bmatrix} =
\begin{bmatrix}
0 & 1 & 2 & 0 \\
0 & 0 & 2 & 6 \\
0 & 0 & 0 & 3 \\
\end{bmatrix}.
$$
## Sample answer
The matrix representation of $f$ can be found by plug in the elements $1$, $x$, $x^2$, and $x^3$ in $\alpha$ and calculate
$$
A = [f]_\alpha^\beta = \begin{bmatrix}
| & ~ & ~ & | \\
[f(1)]_\beta & \cdots & \cdots & [f(x^3)]_\beta \\
| & ~ & ~ & | \\
\end{bmatrix} =
\begin{bmatrix}
0 & 1 & 2 & 0 \\
0 & 0 & 2 & 6 \\
0 & 0 & 0 & 3 \\
\end{bmatrix}.
$$
*This note can be found at Course website > Learning resources.*