MATLAB TUTORIAL, part 2.1: Matrix Algebra

This chapter devoted to basic properties of matrices and vector needed in applications. More deep explanation of matrices is given in next chapter.

How to Define Vectors

How to Define Matrices

matlab has special commands to build a matrix with random entries.
rand(m,n) generates \( m \times n \) matrix consisting of uniformly distributed random numbers;
randn(m,n) generates \( m \times n \) matrix consisting of normally distributed random numbers.

Matlab solves linear systems

The system of algebraic equations
\[ {\bf A} \, {\bf x} = {\bf b} , \]
where A is a given matrix and b is specified column vector, may have a unique solution x, may have infinite many solutions, or may gave no solution at all. Another convenient way, and one that is computationally different is to type A\b, which is roughly the same as inv(A)*b. So if one wants to solve the system of equations Ax=b, it is enough to type
Numerical Methods
The condition number of an invertible matrix A is defined to be
\[ \kappa ({\bf A}) = \| {\bf A} \| \, \| {\bf A}^{-1} \| . \]
This quantity is always bigger than (or equal to) 1. We must use the same norm twice on the right-hand side of the above equation. Sometimes the notation is adjusted to make it clear which norm is being used, for example if we use the infinity norm we might write
\[ \kappa_{\infty} ({\bf A}) = \| {\bf A} \|_{\infty} \, \| {\bf A}^{-1} \|_{\infty} . \]