{%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %}
# Matrix representation in $\mathbb{R}^n$
## Problem
Let $f: \mathbb{R}^n \rightarrow \mathbb{R}^m$ be a linear function. Show that there is a matrix $A$ such that $f(\bx) = A\bx$ for any $\bx\in\mathbb{R}^n$.
## Thought
In essence, this problem is asking us to show that every linear function has a matrix representation.
Let us pretend that we do not know much about the matrix representation and explore a bit. The goal is to find $A$, provided that we know $f(\bx)$ for any $\bx\in\mathbb{R}^n$. For example, if $f(\bx_1) = \by_1$ and $f(\bx_2) = \by_2$, then we know $A\bx_1 = \by_1$ and $A\bx_2 = \by_2$. This process reveals lots of information about $A$.
Let us pick some special one. Let $\{\be_1, \ldots, \be_n\}$ be the standard basis of $\mathbb{R}^n$, that is, the columns of the identity matrix $I_n$ of order $n$. Suppose we know $f(\be_1) = \bw_1$, $\ldots$, $f(\be_n) = \bw_n$. Then we have $A\be_1 = \bw_1$, $\ldots$, $A\be_n = \bw_n$. Since $A\be_i$ is exactly the $i$-th column of $A$, we have
$$
A = \begin{bmatrix}
| & ~ & | \\
\bw_1 & \cdots & \bw_n \\
| & ~ & | \\
\end{bmatrix} =
\begin{bmatrix}
| & ~ & | \\
f(\be_1) & \cdots & f(\be_n) \\
| & ~ & | \\
\end{bmatrix}.
$$
The rest of the task is to use the linearity to verify $f(\bx) = A\bx$ for any $\bx\in\mathbb{R}^n$.
## Sample answer
We may choose $A$ to be the matrix representation of $f$ such that
$$
A = [f] = \begin{bmatrix}
| & ~ & | \\
f(\be_1) & \cdots & f(\be_n) \\
| & ~ & | \\
\end{bmatrix},
$$
where $\beta = \{\be_1, \ldots, \be_n\}$ is the standard basis of $\mathbb{R}^n$. Since $A\be_i$ is the $i$-th column of $A$. By definition, it is straightforward to see that $A\be_i = f(\be_i)$ for $i = 1, \ldots, n$.
For any vector $\bx\in\mathbb{R}^n$, it can be written as a linear combination of $\beta$ such that
$$
\bx = c_1\be_1 + \cdots + c_n\be_n.
$$
Thus, we may compute $f(\bx)$ and $A\bx$ independently and see if they are the same.
By the linearity of $f$, we have
$$
\begin{aligned}
f(\bx) &= f(c_1\be_1 + \cdots + c_n\be_n) \\
&= c_1f(\be_1) + \cdots + c_nf(\be_n).
\end{aligned}
$$
On the other hand, by the definition of $A$ we have
$$
\begin{aligned}
A\bx &= A(c_1\be_1 + \cdots + c_n\be_n) \\
&= c_1A\be_1 + \cdots + c_nA\be_n \\
&= c_1f(\be_1) + \cdots + c_nf(\be_n).
\end{aligned}
$$
Therefore, we found a matrix $A$ such that $f(\bx) = A\bx$ for any $\bx\in\mathbb{R}^n$.
*This note can be found at Course website > Learning resources.*