Difference between revisions of "Linear Algebra"
m (→Solving Linear Systems of Equations) |
|||
Line 1: | Line 1: | ||
− | + | == Basics == | |
+ | Let's first make some definitions: | ||
− | = | + | ; Vector : A one-dimensional collection of numbers. Examples: |
+ | : <math>a=\left( \begin{array}{cccc} 1 & 2 & 3 & 4 \end{array} \right), \quad b=\left( \begin{array}{c} 1 \\ 2 \\ 3 \\ 4 \end{array} \right)</math> | ||
− | + | ; Matrix : A two-dimensional collection of numbers. Examples: | |
+ | : <math> A = \left[ \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array} \right], \quad B = \left[ \begin{array}{cc} 9 & 6 \\ 2 & 3 \end{array}\right]</math> | ||
− | + | ; Array : An ''n''-dimensional collection of numbers. A ''vector'' is a 1-dimensional array while a ''matrix'' is a 2-dimensional array. | |
+ | ; Transpose : An operation that involves interchanging the rows and columns of an array. It is indicated by a <math>^\mathsf{T}</math> superscript. For example: | ||
+ | : <math>a=\left( \begin{array}{cccc} 1 & 2 & 3 & 4 \end{array} \right) \; \Rightarrow \; a^\mathsf{T} = \left( \begin{array}{c} 1 \\ 2 \\ 3 \\ 4 \end{array} \right) </math> | ||
+ | : <math> A = \left[ \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array} \right] \; \Rightarrow \; | ||
+ | A^\mathsf{T} = \left[ \begin{array}{cc} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{array} \right] | ||
+ | </math> | ||
+ | |||
+ | ; Vector Magnitude, <math>\left|\vec{a}\right|</math> : A measure of the length of a vector, <math>\left|\vec{a}\right| = \sqrt{ \sum_{i=1}^{n} a_i^2 }</math> | ||
+ | : Example: <math>\vec{a}=\left( \begin{array}{ccc} 2 & 8 & 3 \end{array} \right) \; \Rightarrow \; \left|\vec{a}\right| = \sqrt{ 2^2 + 8^2 + 3^2 }</math> | ||
+ | : Example: <math>\vec{b}=\left( \begin{array}{cccc} b_1 & b_2 & b_3 & b_4\end{array} \right) \; \Rightarrow \; \left|\vec{b}\right| = \sqrt{ b_1^2 + b_2^2 + b_3^2 +b_4^2 } </math> | ||
== Matrix & Vector Algebra == | == Matrix & Vector Algebra == | ||
+ | |||
+ | There are many common operations involving matrices and vectors including: | ||
+ | * [[#Vector_Dot_Product|Vector dot product]] | ||
+ | * [[#Vector_Cross_Product|Vector cross product]] | ||
+ | * [[#Matrix-Vector Product|Matrix-vector product]] | ||
+ | * [[#Matrix-Matrix Product|Matrix-matrix product]] | ||
+ | These are each discussed in the following sub-sections. | ||
=== Vector Dot Product === | === Vector Dot Product === | ||
+ | The dot product of two vectors produces a scalar. Physically, the dot product of '''a''' and '''b''' represents the ''projection'' of '''a''' onto '''b'''. | ||
+ | |||
+ | Given two vectors '''a''' and '''b''', their dot product is formed as | ||
+ | <center><math> | ||
+ | c = \vec{a} \cdot \vec{b} = \sum_{i=1}^n a_i b_i, | ||
+ | </math></center> | ||
+ | where <math>a_i</math> and <math>b_i</math> are the components in vectors '''a''' and '''b''' respectively. This is most useful when we know the components of the vectors '''a''' and '''b'''. | ||
+ | |||
+ | Occasionally we know the magnitude of the two vectors and the angle between them. In this case, we can calculate the dot product as | ||
+ | <center><math> | ||
+ | |c| = |a|\,|b|\,\cos(\theta), | ||
+ | </math></center> | ||
+ | where <var>θ</var> is the angle between the vectors '''a''' and '''b'''. | ||
+ | |||
+ | For more information on the dot product: [http://en.wikipedia.org/wiki/Dot_product] | ||
+ | |||
+ | ==== Thought examples ==== | ||
+ | Consider the cartoon shown to the right. [[image:dotProdExample.png|right|200px]] | ||
+ | |||
+ | * At noon, when the sun is directly overhead, a rocket is launched directly toward the sun at 1000 mph. How fast is its shadow moving? | ||
+ | : Define the rocket's velocity as <math>\vec{R}</math>. | ||
+ | : Define the unit normal on the ground (i.e. the direction of the rocket's shadow on the ground) as <math>\vec{s}</math>, where <math>|\vec{s}| = 1</math>. | ||
+ | : Intuition tells us that if the it is moving directly toward the sun, then its shadow does not appear to move at all. : The dot product <math>\vec{R}\cdot\vec{s} = |\vec{R}| \, |\vec{s}| \cos(\theta) = 0</math> since cos(90°)=0. | ||
+ | |||
+ | * Consider the same rocket going parallel to the earth's surface. How fast is its shadow moving? | ||
+ | : If the rocket is going parallel to the earth's surface, our intuition tells us that is shadow is moving at the same speed. This is confirmed by the mathematics, since the angle between the rocket's path and the ground is 0. Therefore, <math>\vec{R}\cdot\vec{s} = |\vec{R}| \, |\vec{s}| \cos(\theta) = 0</math> since cos(0°)=1. | ||
+ | |||
+ | * What if the rocket were going at a 45° angle? | ||
+ | : Our intuition tells us that the shadow will appear to move, but it will not be moving as fast as the rocket is moving. Mathematically, we have <math>v_s = \vec{R}\cdot\vec{s} = |\vec{R}| |\vec{s}| \cos(45^\circ) = 500\sqrt{2} = 707.1 \, \textrm{mph}</math>. | ||
+ | |||
+ | |||
=== Vector Cross Product === | === Vector Cross Product === | ||
+ | |||
+ | Assume that we have vectors '''a''' and '''b''' defined as | ||
+ | <center> | ||
+ | <math> | ||
+ | \begin{align} | ||
+ | \vec{a} &= a_x \hat{i} + a_y \hat{j} + a_z \hat{k} \\ | ||
+ | \vec{b} &= b_x \hat{i} + b_y \hat{j} + b_z \hat{k} | ||
+ | \end{align} | ||
+ | </math> | ||
+ | </center> | ||
+ | where <math>\hat{i}</math>, <math>\hat{j}</math>, and <math>\hat{k}</math> represent the unit-normal vectors in the <var>x</var>, <var>y</var>, and <var>z</var> directions, respectively. | ||
+ | The cross product of '''a''' and '''b''' is then defined as | ||
+ | <center><math> | ||
+ | \vec{c} = \vec{a} \times \vec{b} = \left( a_y b_z -a_z b_y \right) \hat{i} + \left(a_z b_x -a_x b_z\right) \hat{j} + \left(a_x b_y -a_y b_x\right) \hat{k} | ||
+ | </math></center> | ||
+ | |||
=== Matrix-Vector Product === | === Matrix-Vector Product === | ||
+ | |||
=== Matrix-Matrix Product === | === Matrix-Matrix Product === | ||
Revision as of 10:36, 25 August 2008
Contents
Basics
Let's first make some definitions:
- Vector
- A one-dimensional collection of numbers. Examples:
- Matrix
- A two-dimensional collection of numbers. Examples:
- Array
- An n-dimensional collection of numbers. A vector is a 1-dimensional array while a matrix is a 2-dimensional array.
- Transpose
- An operation that involves interchanging the rows and columns of an array. It is indicated by a superscript. For example:
- Vector Magnitude,
- A measure of the length of a vector,
- Example:
- Example:
Matrix & Vector Algebra
There are many common operations involving matrices and vectors including:
These are each discussed in the following sub-sections.
Vector Dot Product
The dot product of two vectors produces a scalar. Physically, the dot product of a and b represents the projection of a onto b.
Given two vectors a and b, their dot product is formed as
where and are the components in vectors a and b respectively. This is most useful when we know the components of the vectors a and b.
Occasionally we know the magnitude of the two vectors and the angle between them. In this case, we can calculate the dot product as
where θ is the angle between the vectors a and b.
For more information on the dot product: [1]
Thought examples
Consider the cartoon shown to the right.- At noon, when the sun is directly overhead, a rocket is launched directly toward the sun at 1000 mph. How fast is its shadow moving?
- Define the rocket's velocity as .
- Define the unit normal on the ground (i.e. the direction of the rocket's shadow on the ground) as , where .
- Intuition tells us that if the it is moving directly toward the sun, then its shadow does not appear to move at all. : The dot product since cos(90°)=0.
- Consider the same rocket going parallel to the earth's surface. How fast is its shadow moving?
- If the rocket is going parallel to the earth's surface, our intuition tells us that is shadow is moving at the same speed. This is confirmed by the mathematics, since the angle between the rocket's path and the ground is 0. Therefore, since cos(0°)=1.
- What if the rocket were going at a 45° angle?
- Our intuition tells us that the shadow will appear to move, but it will not be moving as fast as the rocket is moving. Mathematically, we have .
Vector Cross Product
Assume that we have vectors a and b defined as
where , , and represent the unit-normal vectors in the x, y, and z directions, respectively. The cross product of a and b is then defined as
Matrix-Vector Product
Matrix-Matrix Product
Linear Systems of Equations
Solving Linear Systems of Equations
|
Direct Solvers
Gaussian Elimination
The Thomas Algorithm (Tridiagonal Systems)
Iterative Solvers
Jacobi Method
Gauss-Seidel Method
Other Methods
- Conjugate-Gradient
- GMRES