1.6 KiB
Linear Algebra
In mathematics linear algebra is an extension of the classical elemental algebra ("operations with numbers") to vectors and matrices. It is a basic tool of advanced mathematics and computer science and at least at the very basic level should be known by every programmer.
The Basics
In "normal" algebra our basic elements are numbers; we learn to to add then, multiply then, solve equation with them etc. In linear algebra our elements are vectors and matrices and we learn to perform similar operations with them, even though they sometimes behave a bit different.
Vectors are basically sequences (arrays) of numbers, e.g. a vector of length 3 may be [1.5, 0, -302]. A matrix can be seen as a two dimensional vector (a 2D array of numbers), e.g. a 2x3 matrix may look like this:
|1 2.5 -10|
|24 -3 0 |
Why work with vectors and matrices? Because these can represent certain things we encounter in math and programming better than numbers, e.g. vectors may represent points in space and matrices may represent transformations.
With vectors and matrices we can perform similar operations as with normal numbers, i.e. addition, subtraction, multiplication, but there are also new operations and some operations may behave differently. E.g. vectors have two kinds of "multiplication": dot product and vector product, and matrix multiplication is non-commutative. We can also solve equations with vectors and matrices.