You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.4 KiB

Linear Algebra

In mathematics linear algebra is an extension of the classical elemental algebra ("operations with numbers/variables") to vectors and matrices ("arrays of numbers"). It is a basic tool of advanced mathematics and computer science (and many other sciences) and at least at the very basic level should be known by every programmer.

Why is it called linear algebra? Basically because it deals with linear equations which is kind of about proportionality, function plots being lines etc. A mathematician will probably puke at this explanation but it gives some intuition :)

The Basics

In "normal" algebra our basic elements are numbers; we learn to add then, multiply then, solve equation with them etc. In linear algebra we call these "single numbers" scalars but also add more complex elements: vectors and matrices and we learn to perform similar operations with them, even though they sometimes behave a bit differently.

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 or velocities with directions 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. when dealing with vectors, there are multiple ways to "multiply" them: we may multiply a vector with a scalar but also a vector with vector (and there are multiple way to do this such as dot product and cross product). Matrix multiplication is, unlike multiplication of real numbers, non-commutative (A times B doesn't necessarily equal B times A), but its still distributive. We can also multiply vectors with matrices but only those that have "compatible sizes". And we can also solve equations and systems of equations which have vectors and matrices in them.