# codefinance.training

Coding for Finance

# Matrix Algebra

### Matrix Algebra

In abstract algebra, a matrix ring is a set of matrices with entries in a ring R that form a ring under matrix addition and matrix multiplication.[1] The set of all n × n matrices with entries in R is a matrix ring denoted Mn(R)[2][3][4][5] (alternative notations: Matn(R)[3] and Rn×n[6]). Some sets of infinite matrices form infinite matrix rings. A subring of a matrix ring is again a matrix ring. Over a rng, one can form matrix rngs.

When R is a commutative ring, the matrix ring Mn(R) is an associative algebra over R, and may be called a matrix algebra. In this setting, if M is a matrix and r is in R, then the matrix rM is the matrix M with each of its entries multiplied by r.

## Examples

• The set of all n × n square matrices over R, denoted Mn(R). This is sometimes called the "full ring of n-by-n matrices".
• The set of all upper triangular matrices over R.
• The set of all lower triangular matrices over R.
• The set of all diagonal matrices over R. This subalgebra of Mn(R) is isomorphic to the direct product of n copies of R.
• For any index set I, the ring of endomorphisms of the right R-module is isomorphic to the ring [citation needed] of column finite matrices whose entries are indexed by I × I and whose columns each contain only finitely many nonzero entries. The ring of endomorphisms of M considered as a left R-module is isomorphic to the ring of row finite matrices.
• If R is a Banach algebra, then the condition of row or column finiteness in the previous point can be relaxed. With the norm in place, absolutely convergent series can be used instead of finite sums. For example, the matrices whose column sums are absolutely convergent sequences form a ring.[dubiousdiscuss] Analogously of course, the matrices whose row sums are absolutely convergent series also form a ring.[dubiousdiscuss] This idea can be used to represent operators on Hilbert spaces, for example.
• The intersection of the row-finite and column-finite matrix rings forms a ring .
• If R is commutative, then Mn(R) has a structure of a *-algebra over R, where the involution * on Mn(R) is matrix transposition.
• If A is a C*-algebra, then Mn(A) is another C*-algebra. If A is non-unital, then Mn(A) is also non-unital. By the Gelfand–Naimark theorem, there exists a Hilbert space H and an isometric *-isomorphism from A to a norm-closed subalgebra of the algebra B(H) of continuous operators; this identifies Mn(A) with a subalgebra of B(Hn). For simplicity, if we further suppose that H is separable and A B(H) is a unital C*-algebra, we can break up A into a matrix ring over a smaller C*-algebra. One can do so by fixing a projection p and hence its orthogonal projection 1 − p; one can identify A with , where matrix multiplication works as intended because of the orthogonality of the projections. In order to identify A with a matrix ring over a C*-algebra, we require that p and 1 − p have the same "rank"; more precisely, we need that p and 1 − p are Murray–von Neumann equivalent, i.e., there exists a partial isometry u such that p = uu* and 1 − p = u*u. One can easily generalize this to matrices of larger sizes.
• Complex matrix algebras Mn(C) are, up to isomorphism, the only finite-dimensional simple associative algebras over the field C of complex numbers. Prior to the invention of matrix algebras, Hamilton in 1853 introduced a ring, whose elements he called biquaternions[7] and modern authors would call tensors in CR H, that was later shown to be isomorphic to M2(C). One basis of M2(C) consists of the four matrix units (matrices with one 1 and all other entries 0); another basis is given by the identity matrix and the three Pauli matrices.
• A matrix ring over a field is a Frobenius algebra, with Frobenius form given by the trace of the product: σ(A, B) = tr(AB).

## Structure

• The matrix ring Mn(R) can be identified with the ring of endomorphisms of the free right R-module of rank n; that is, Mn(R) ≅ EndR(Rn). Matrix multiplication corresponds to composition of endomorphisms.
• The ring Mn(D) over a division ring D is an Artinian simple ring, a special type of semisimple ring. The rings and are not simple and not Artinian if the set I is infinite, but they are still full linear rings.
• The Artin–Wedderburn theorem states that every semisimple ring is isomorphic to a finite direct product , for some nonnegative integer r, positive integers ni, and division rings Di.
• When we view Mn(C) as the ring of linear endomorphisms of Cn, those matrices which vanish on a given subspace V form a left ideal. Conversely, for a given left ideal I of Mn(C) the intersection of null spaces of all matrices in I gives a subspace of Cn. Under this construction, the left ideals of Mn(C) are in bijection with the subspaces of Cn.
• There is a bijection between the two-sided ideals of Mn(R) and the two-sided ideals of R. Namely, for each ideal I of R, the set of all n × n matrices with entries in I is an ideal of Mn(R), and each ideal of Mn(R) arises in this way. This implies that Mn(R) is simple if and only if R is simple. For n ≥ 2, not every left ideal or right ideal of Mn(R) arises by the previous construction from a left ideal or a right ideal in R. For example, the set of matrices whose columns with indices 2 through n are all zero forms a left ideal in Mn(R).
• The previous ideal correspondence actually arises from the fact that the rings R and Mn(R) are Morita equivalent. Roughly speaking, this means that the category of left R-modules and the category of left Mn(R)-modules are very similar. Because of this, there is a natural bijective correspondence between the isomorphism classes of left R-modules and left Mn(R)-modules, and between the isomorphism classes of left ideals of R and left ideals of Mn(R). Identical statements hold for right modules and right ideals. Through Morita equivalence, Mn(R) inherits any Morita-invariant properties of R, such as being simple, Artinian, Noetherian, prime.

## Properties

• If S is a subring of R, then Mn(S) is a subring of Mn(R). For example, Mn(Z) is a subring of Mn(Q).
• The matrix ring Mn(R) is commutative if and only if n = 0, R = 0, or R is commutative and n = 1. In fact, this is true also for the subring of upper triangular matrices. Here is an example showing two upper triangular 2 × 2 matrices that do not commute, assuming 1 ≠ 0 in R:
and
• For n ≥ 2, the matrix ring Mn(R) over a nonzero ring has zero divisors and nilpotent elements; the same holds for the ring of upper triangular matrices. An example in 2 × 2 matrices would be
• The center of Mn(R) consists of the scalar multiples of the identity matrix, In, in which the scalar belongs to the center of R.
• The unit group of Mn(R), consisting of the invertible matrices under multiplication, is denoted GLn(R).
• If F is a field, then for any two matrices A and B in Mn(F), the equality AB = In implies BA = In. This is not true for every ring R though. A ring R whose matrix rings all have the mentioned property is known as a stably finite ring (Lam 1999, p. 5).

## Matrix semiring

In fact, R needs to be only a semiring for Mn(R) to be defined. In this case, Mn(R) is a semiring, called the matrix semiring. Similarly, if R is a commutative semiring, then Mn(R) is a matrix semialgebra.

For example, if R is the Boolean semiring (the two-element Boolean algebra R = {0, 1} with 1 + 1 = 1),[8] then Mn(R) is the semiring of binary relations on an n-element set with union as addition, composition of relations as multiplication, the empty relation (zero matrix) as the zero, and the identity relation (identity matrix) as the unity.[9]

## Citations

1. ^ Lam (1999), Theorem 3.1
2. ^
3. ^ a b Lang (2005), V.§3
4. ^ Serre (2006), p. 3
5. ^ Serre (1979), p. 158
6. ^ Artin (2018), Example 3.3.6(a)
7. ^ Lecture VII of Sir William Rowan Hamilton (1853) Lectures on Quaternions, Hodges and Smith
8. ^ Droste & Kuich (2009), p. 7
9. ^ Droste & Kuich (2009), p. 8

## References

• Artin (2018), Algebra, Pearson
• Droste, M.; Kuich, W (2009), "Semirings and Formal Power Series", Handbook of Weighted Automata, Monographs in Theoretical Computer Science. An EATCS Series, pp. 3–28, doi:10.1007/978-3-642-01492-5_1, ISBN 978-3-642-01491-8
• Lam, T. Y. (1999), Lectures on modules and rings, Graduate Texts in Mathematics No. 189, Berlin, New York: Springer-Verlag, ISBN 978-0-387-98428-5
• Lam (2001), A first course on noncommutative rings (2nd ed.), Springer
• Lang (2005), Undergraduate algebra, Springer
• Serre (1979), Local fields, Springer
• Serre (2006), Lie algebras and Lie groups (2nd ed.), Springer, corrected 5th printing

Strategic Asset Allocation in Fixed Income Markets:
A Matlab Based User′s Guide

Ken Nyholm -
"An extremely useful book for anyone interested in actually applying MATLAB based computational techniques to fixed-income problems"

Practical C++20 Financial Programming:
Problem Solving for Quantitative Finance, Financial Engineering, Business, and Economics

Carlos Oliveira -
Updated for C++20, this book covers those aspects of the language that are more frequently used in writing financial software.

An Introduction for Statistical Learning (with R examples):
Gareth James, Daniela Witten, Trevor Hastie and Robert Tibshirani -
This book presents some of the most important modeling and prediction techniques in Statistical Learning as well as exploring relevant applications.