# Matrix-valued function: understanding

$$A(x)=(a_{i,j}(x))_{i,j}: \mathbb{R}^n\to \mathbb{R}^{m\times k}$$ is a matrix-valued function.

From my understanding it is a function that maps a vector to a matrix. How does this happen? Is the 'function' a matrix of which the elements are functions? If so, are these just $$\mathbb{R}^n-\mathbb{R}$$-functions?

I don't really understand the form of a matrix-valued function and how it 'takes' the required input. Maybe an example could be helpful?

Thanks a lot.

Consider first the definition of function in the most general sense. A function $$f: A\to B$$ between two sets $$A$$ and $$B$$ is a process that associates to each element of $$A$$ a single element of $$B$$. Following this definition, there is nothing special to take $$A=\Bbb R^n$$ and $$B=\Bbb R^{m\times k}$$.

The most trivial function between the above set is the constant function namely, a process that associates to each vector of $$\Bbb R^{n}$$ the same matrix $$M$$. But you can also define functions that associate to each vector $$v$$ of $$\Bbb R^n$$ a matrix whose entries depend on the coordinates of the $$v$$ (I am thinking $$\Bbb R^n$$ with the standard basis). For instance, @MachineLearner gave you a very explicit example. As a function $$g:\Bbb R^n \to \Bbb R^m$$ can be seen as $$g(x_1,\dots,x_n)=\big(g_1(x_1,\dots,x_n),\dots,g_m(x_1,\dots,x_n)\big)$$

any function $$f:\Bbb R^n\to \Bbb R^{m\times k}$$ can be seen as $$f(x_1,\dots,x_n)= \begin{pmatrix} a_{11}(x_1,\dots,x_n) &\cdots & a_{1k}(x_1,\dots,x_n)\\ \dots & \dots & \dots\\ a_{m1}(x_1,\dots,x_n) & \dots & a_{mk}(x_1,\dots,x_n)\end{pmatrix}$$

Hence yes, such a function can be seen as a matrix whose entries are $$\Bbb R^n\to\Bbb R$$ functions.

Furthermore, such a function appears very often. For instance, consider a smooth function $$h:\Bbb R^n\to \Bbb R^m$$. The Jacobian $$J(h)(x_1,\dots,x_n)$$ is a smooth function whose source is again $$\Bbb R^n$$, but the target is the space of $$n\times m$$ matrices. Each entry is a $$\Bbb R^n\to \Bbb R$$ function namely, $${J(h)}_{ij}(x_1,\dots,x_n)=\frac{\partial h_i}{\partial x_j}(x_1,\dots,x_n).$$

As an example: Imagine $$x=[x_1,x_2]^T\in \mathbb{R}^2$$ Then the function

$$A(x)= \begin{bmatrix} x_1x_2 & x_1^2\sin x_2 & x_2 \\ x_1x_2^3 & x_2\exp(x_1) & 2x_2x_1\sin(x_1) \\ \end{bmatrix}$$

is a map from $$\mathbb{R}^2\to \mathbb{R}^{2\times3}$$. The entries of the matrix are multivariate scalar functions.

A more geometric example: let $$T$$ be a function that maps a vector $$v$$ to a rotation around the vector $$v$$ by $$\frac{\pi}{6}$$. Then you can represent this function as a function from $$\mathbb{R}^n$$ to $$\mathbb{R}^{n \times n}$$.