# Example of a Matrix as a Morphism in Category Theory

In this example, we explore the **category of matrices**, where the objects are vector spaces (or sets of vectors) and the morphisms are matrices that map from one vector space to another.

For instance, a \( 2 \times 3 \) matrix can be viewed as a morphism between a 3-dimensional vector space (domain) and a 2-dimensional vector space (codomain).

$$ M = \begin{bmatrix}

a & b & c \\

d & e & f \\

\end{bmatrix} $$

This is because a \( 2 \times 3 \) matrix has 2 rows and 3 columns and can be used to transform a 3-dimensional vector (R^{3}) into a 2-dimensional vector (R^{2}).

$$ M \mathbf{v} = \begin{bmatrix}

a & b & c \\

d & e & f \\

\end{bmatrix} \begin{bmatrix}

x \\

y \\

z \\

\end{bmatrix} $$

In other words, if we call the 3-dimensional vector space \( V \) and the 2-dimensional vector space \( W \), then a \( 2 \times 3 \) matrix represents a morphism \( f:V \rightarrow W \).

$$ f: V \rightarrow W $$

Thus, a \( 2 \times 3 \) matrix is an example of a morphism in the category of matrices, mapping between two vector spaces.

Here is a **practical example** using a matrix and vectors I have chosen randomly. $ A \mathbf{v} = \begin{bmatrix}

1 & 2 & 3 \\

4 & 5 & 6 \\

\end{bmatrix} \begin{bmatrix}

1 \\

1 \\

1 \\

\end{bmatrix} = \begin{bmatrix}

1 \cdot 1 + 2 \cdot 1 + 3 \cdot 1 \\

4 \cdot 1 + 5 \cdot 1 + 6 \cdot 1 \\

\end{bmatrix} = \begin{bmatrix}

6 \\

15 \\

\end{bmatrix}

$$

**Composition of Morphisms**

Consider a matrix \( A \) of dimensions \( 2 \times 3 \) and a matrix \( B \) of dimensions \( 3 \times 2 \).

The composition of these matrices \( A \circ B \) results in a \( 2 \times 2 \) matrix.

In category theory, this means we are composing two morphisms: one that maps from \( V \) to \( W \) and another that maps from \( W \) to \( V \).

**Example**. Here is a practical example of composing two matrices \( A \) and \( B \). The matrix \( A \) of dimensions \( 2 \times 3 \) acts as a morphism from the three-dimensional vector space \( V = R^3 \) to the two-dimensional space \( W = R^2 \).

$$

A = \begin{bmatrix}

1 & 0 & 2 \\

-1 & 3 & 1 \\

\end{bmatrix} $$

The matrix \( B \) of dimensions \( 3 \times 2 \), acts as a morphism from the two-dimensional vector space \( W \) to the three-dimensional space \( V \).

$$

B = \begin{bmatrix}

3 & 1 \\

0 & -1 \\

1 & 0 \\

\end{bmatrix} $$

The composition \( A \circ B \) involves multiplying \( A \) by \( B \). The result is a \( 2 \times 2 \) matrix that maps the two-dimensional space \( V \) onto itself via the three-dimensional space \( W \). Let's compute the product:

$$

A \circ B = AB = \begin{bmatrix}

1 & 0 & 2 \\

-1 & 3 & 1 \\

\end{bmatrix} \begin{bmatrix}

3 & 1 \\

0 & -1 \\

1 & 0 \\

\end{bmatrix} $$

$$

AB = \begin{bmatrix}

(1 \times 3 + 0 \times 0 + 2 \times 1) & (1 \times 1 + 0 \times -1 + 2 \times 0) \\

(-1 \times 3 + 3 \times 0 + 1 \times 1) & (-1 \times 1 + 3 \times -1 + 1 \times 0) \\

\end{bmatrix} $$

$$

AB = \begin{bmatrix}

5 & 1 \\

-2 & -4 \\

\end{bmatrix} $$

In category theory, this operation represents the composition of two morphisms:

- The morphism \( B \) maps \( W \rightarrow V \)
- The morphism \( A \) maps \( V \rightarrow W \)

The resulting matrix \( AB \) maps \( V \) directly onto itself, passing through \( W \) as an intermediate space. This operation demonstrates how the composition of morphisms not only transfers vectors through spaces but also connects various transformations.

This composition and the resulting structure satisfy the necessary properties for morphisms in category theory:

**Identity**

For every matrix, there is an identity matrix that, when composed with any other matrix \( A \), returns \( A \).**Associativity**

Matrix composition is associative, meaning \( (A \circ B) \circ C = A \circ (B \circ C) \).

Using morphisms, we can describe not only direct transformations between elements of sets but also more complex transformations that respect algebraic or geometric structures.

**Note**. A \( 2 \times 3 \) matrix does not establish a direct relationship between individual numbers in \( \mathbb{R}^3 \) and \( \mathbb{R}^2 \), but rather describes how each vector in \( \mathbb{R}^3 \) is transformed into a vector in \( \mathbb{R}^2 \). For this reason, it is not called a "function" but is preferred to be termed a "morphism," indicating a transformation of form.

This demonstrates how morphisms in category theory can represent structured and abstract transformations between mathematical objects.

And so on.