20 lines
2.4 KiB
Markdown
20 lines
2.4 KiB
Markdown
# Linear Algebra
|
|
|
|
In [mathematics](math.md) linear algebra is an extension of the classical elemental algebra ("operations with numbers/variables") to [vectors](vector.md) and [matrices](matrix.md) ("arrays of numbers"). It is a basic tool of advanced mathematics and [computer science](computer_science.md) (and many other sciences) and at least at the very basic level should be known by every [programmer](programmer.md).
|
|
|
|
Why is it called *linear* algebra? Basically because it deals with [linear equations](linear.md) 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](number.md); we learn to add then, multiply then, solve equation with them etc. In linear algebra we call these "single numbers" [scalars](scalar.md) but also add more complex elements: [vectors](vector.md) and [matrices](matrix.md) and we learn to perform similar operations with them, even though they sometimes behave a bit differently.
|
|
|
|
Vectors are basically sequences ([arrays](array.md)) of numbers, e.g. a vector of length 3 may be [1.5, 0, -302]. A matrix can be seen as a [two dimensional](2d.md) 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](dot_product.md) and [cross product](cross_product.md)). Matrix multiplication is, unlike multiplication of real numbers, non-[commutative](commutativity.md) (A times B doesn't necessarily equal B times A), but its still [distributive](distributivity.md). 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. |