Untitled

Chapter 1: Vectors in 3D Space and Vector Space
1. Vectors in 3D Space

1.1 Rectangular Cartesian Coordinate Systems

In Rectangular Cartesian coordinate systems, vectors that span the frame axes (X, Y, Z) are defined with respect to three basis vectors: i,j,k\mathbf{i}, \mathbf{j}, \mathbf{k}. These vectors represent the unit vectors along the X, Y, and Z axes, respectively. There are two conventions for these coordinate systems:

  • Left-handed system: Used in DirectX.

  • Right-handed system: Used in OpenGL and is the standard convention in mathematics and physics.

The right-handed system defines an orthonormal basis where the vectors satisfy:

  • i⊥j\mathbf{i} \perp \mathbf{j}

  • j⊥k\mathbf{j} \perp \mathbf{k}

  • k⊥i\mathbf{k} \perp \mathbf{i}

  • ∣i∣=∣j∣=∣k∣=1|\mathbf{i}| = |\mathbf{j}| = |\mathbf{k}| = 1

1.2 Definition and Representation of Vectors

A vector is defined as a mathematical entity that possesses both a direction and a magnitude. For example, a vector a\mathbf{a} can be represented in 3D space as:

a=(x,y,z)\mathbf{a} = (x, y, z),

where:

  • xx is the 1st component.

  • yy is the 2nd component.

  • zz is the 3rd component.

Three fundamental vectors that span the world space are defined as:

  • i=(1,0,0)\mathbf{i} = (1, 0, 0)

  • j=(0,1,0)\mathbf{j} = (0, 1, 0)

  • k=(0,0,1)\mathbf{k} = (0, 0, 1)

Any vector in the world space can be expressed as a linear combination of these basis vectors:
a=xi+yj+zk\mathbf{a} = x \mathbf{i} + y \mathbf{j} + z \mathbf{k}
For example, for a=(2,3,5)\mathbf{a} = (2, 3, 5), it can be expressed as:
a=2i+3j+5k\mathbf{a} = 2 \mathbf{i} + 3 \mathbf{j} + 5 \mathbf{k}

1.3 Python Implementation

To define a vector in Python, you can use the NumPy, SciPy, or SymPy libraries. Here are examples:

  • NumPy:

import numpy as np
vector = np.array([data], dtype=float)
  • SciPy:

import scipy
vector = scipy.array([data], dtype=float)
  • SymPy:

from sympy import Matrix
vector = Matrix(data)
2. Vector Norm

2.1 Definition

Given a vector a=(a1,a2,a3)\mathbf{a} = (a_1, a_2, a_3), its norm (or length or magnitude) is defined as:

∣a∣=a12+a22+a32|\mathbf{a}| = \sqrt{a_1^2 + a_2^2 + a_3^2}
where:

  • For all basis vectors, ∣i∣=∣j∣=∣k∣=1|\mathbf{i}| = |\mathbf{j}| = |\mathbf{k}| = 1

2.2 Examples

  • Example 2.1: Calculate the norm of a=(−3,0,4)\mathbf{a} = (-3, 0, 4):

∣a∣=(−3)2+02+42=9+0+16=25=5|\mathbf{a}| = \sqrt{(-3)^2 + 0^2 + 4^2} = \sqrt{9 + 0 + 16} = \sqrt{25} = 5

  • Example 2.2: Calculate the norm of a=(−2,1,1)\mathbf{a} = (-2, 1, 1):

∣a∣=(−2)2+12+12=4+1+1=6=6|\mathbf{a}| = \sqrt{(-2)^2 + 1^2 + 1^2} = \sqrt{4 + 1 + 1} = \sqrt{6} = \sqrt{6}

2.3 How to Compute Vector Length in Python

Python uses the following methods to compute lengths:

  • NumPy: numpy.linalg.norm()

  • SciPy: scipy.linalg.norm()

  • SymPy: magnitude() from sympy.physics.vector.

3. Normalized Vectors and Unit Vectors

3.1 Normalization

A normalized vector is one that has a magnitude of 1. It is obtained by dividing the vector by its magnitude:
aunit=a∣a∣\mathbf{\text{a}}^{\text{unit}} = \frac{\mathbf{a}}{|\mathbf{a}|}
A unit vector can also be referred to as a normalized vector. The normalization condition is:
∣aunit∣=1|\mathbf{\text{a}}^{\text{unit}}| = 1

3.2 Examples

  • Example 3.1: Normalize a=(−1,0,1)\mathbf{a} = (-1, 0, 1):

  • First, find the norm:

∣a∣=(−1)2+02+12=1|\mathbf{a}| = \sqrt{(-1)^2 + 0^2 + 1^2} = 1

  • Then normalize:

aunit=a1=(−1,0,1)\mathbf{\text{a}}^{\text{unit}} = \frac{\mathbf{a}}{1} = (-1, 0, 1)

  • Example 3.2: Normalize u=(3,1,2)\mathbf{u} = (3, 1, 2):

  • First, find the norm:

∣u∣=32+12+22=9+1+4=14=7|\mathbf{u}| = \sqrt{3^2 + 1^2 + 2^2} = \sqrt{9 + 1 + 4} = \sqrt{14} = 7

  • Then normalize:

uunit=u7=114(3,1,2)\mathbf{\text{u}}^{\text{unit}} = \frac{\mathbf{u}}{7} = \frac{1}{\sqrt{14}}(3, 1, 2)

3.3 Normalizing a Vector in Python

To normalize a vector in Python, use:

  • normalize() from sympy.physics.vector.

4. Vector Direction

The direction of a vector is represented by its normalized vector:
aunit=a∣a∣\mathbf{a}^{\text{unit}} = \frac{\mathbf{a}}{|\mathbf{a}|}

4.1 Examples

  • Example 4.1: Determine the direction of a car moving with a velocity v=(1,0,1)\mathbf{v} = (1, 0, 1):

  • First, find the norm:

∣v∣=12+02+12=1+0+1=1|\mathbf{v}| = \sqrt{1^2 + 0^2 + 1^2} = \sqrt{1 + 0 + 1} = 1

  • Hence, the direction is:

vunit=(1,0,1)1=(1,0,1)\mathbf{v}^{\text{unit}} = \frac{(1, 0, 1)}{1} = (1, 0, 1)

5. Parallel and Collinear Vectors

Vectors a\mathbf{a} and b\mathbf{b} are parallel if:

a=kb\mathbf{a} = k\mathbf{b} for some scalar kk. The relationship can be defined as:

a∥b if a=kb for some k≠0\mathbf{a} \parallel \mathbf{b} \text{ if } \mathbf{a} = k\mathbf{b} \text{ for some } k \neq 0

5.1 Examples

  • Example 5.1: Prove that vectors a=(2,3,1)\mathbf{a} = (2, 3, 1) and b=(6,9,3)\mathbf{b} = (6, 9, 3) are collinear:

b=3a hence a∥b\mathbf{b} = 3\mathbf{a} \text{ hence } \mathbf{a} \parallel \mathbf{b}

6. Building a Vector From Two Given Points (Vertices)

Given two points (vertices) AA and BB, the vector AB\mathbf{AB} is defined as:
AB=B−A\mathbf{AB} = \mathbf{B} - \mathbf{A}

  • Here, A\mathbf{A} is the vector origin and B\mathbf{B} is the vector head (terminal point).

  • The opposite of vector AB\mathbf{AB} is denoted as −AB-\mathbf{AB}. It follows that:

−AB=BA-\mathbf{AB} = \mathbf{BA} where BA=A−B\mathbf{BA} = \mathbf{A} - \mathbf{B}.

6.1 Distance Between Two Points

The distance between points AA and BB can be computed as:
d(A,B)=∣AB∣d(A, B) = |\mathbf{AB}|

6.2 Example

  • Example 6.1: Given two vertices A=(2,3,1)A=(2, 3, 1) and B=(5,3,5)B=(5, 3, 5):

  1. Compute the vector AB\mathbf{AB}:
    AB=(5,3,5)−(2,3,1)=(3,0,4)\mathbf{AB} = (5, 3, 5) - (2, 3, 1) = (3, 0, 4)

  2. The opposite vector BA\mathbf{BA} is:
    −AB=−AB-\mathbf{AB} = -\mathbf{AB}.

  3. Distance: d(A,B)=∣AB∣=9+0+16=5d(A, B) = |\mathbf{AB}| = \sqrt{9 + 0 + 16} = 5

7. Vectors Algebra

Given two vectors a\mathbf{a} and b\mathbf{b}:

7.1 Vector Addition

Vectors are added component-wise:
a+b=(a1,a2,a3)+(b1,b2,b3)=(a1+b1,a2+b2,a3+b3)\mathbf{a} + \mathbf{b} = (a_1, a_2, a_3) + (b_1, b_2, b_3) = (a_1 + b_1, a_2 + b_2, a_3 + b_3)

Example 7.1: Adding Two Vectors

Let a=(2,−1,5)\mathbf{a} = (2, -1, 5) and b=(1,3,1)\mathbf{b} = (1, 3, 1):
c=a+b=(2+1,−1+3,5+1)=(3,2,6)\mathbf{c} = \mathbf{a} + \mathbf{b} = (2 + 1, -1 + 3, 5 + 1) = (3, 2, 6)

7.2 Scalar Multiplication

A vector can be multiplied by a scalar:
ka=(ka1,ka2,ka3)k\mathbf{a} = (k a_1, k a_2, k a_3)

Example 7.2:

Let k=2,a=(2,−1,5)k=2, \mathbf{a} = (2, -1, 5) then:
c=2a=(4,−2,10)\mathbf{c} = 2\mathbf{a} = (4, -2, 10)

7.3 Pythonic Examples

For addition in Python, you can use:

  • NumPy: numpy.add(a, b)

  • SciPy: scipy.add(a, b)

  • SymPy: a + b where you define vectors as Matrix.

8. Geometric Interpretation

Given two vectors a\mathbf{a} and b\mathbf{b}, their sum s\mathbf{s} is represented geometrically:

  • The sum a+b\mathbf{a} + \mathbf{b} can be visualized as the diagonal of a parallelogram defined by vectors a\mathbf{a} and −b-\mathbf{b}.

  • The difference extended from a\mathbf{a} towards b\mathbf{b} is a−b\mathbf{a} - \mathbf{b}.

9. The Dot Product of 2 Vectors

9.1 Definition

The dot product of vectors a\mathbf{a} and b\mathbf{b} is defined as:
a⋅b=∣a∣∣b∣cos⁡(θ)\mathbf{a} \cdot \mathbf{b} = |\mathbf{a}| |\mathbf{b}| \cos(\theta) where θ\theta is the angle between them.

9.2 Example Calculation

  • Example 9.1:
    Let a=(2,1,5)\mathbf{a} = (2, 1, 5) and b=(1,3,1)\mathbf{b} = (1, 3, 1):
    a⋅b=2×1+1×3+5×1=2+3+5=10\mathbf{a} \cdot \mathbf{b} = 2 \times 1 + 1 \times 3 + 5 \times 1 = 2 + 3 + 5 = 10. The dot product yields a scalar quantity.

9.3 Pythonic Implementation

You can calculate the dot product using:

  • NumPy: numpy.dot(a, b)

  • SciPy: scipy.dot(a, b)

  • SymPy: a.dot(b)

10. The Angle Between Two Vectors

10.1 Calculation

The angle θ\theta between two vectors can be calculated using the formula:
cos⁡(θ)=a⋅b∣a∣×∣b∣\cos(\theta) = \frac{\mathbf{a} \cdot \mathbf{b}}{|\mathbf{a}| \times |\mathbf{b}|}

10.2 Examples

  • Example 10.1: Given a=(1,0,1)\mathbf{a} = (1, 0, 1) and b=(2,0,0)\mathbf{b} = (2, 0, 0),
    Using the dot product:
    θ=arccos⁡((1)(2)+(0)(0)+(1)(0)∣a∣×∣b∣)\theta = \arccos\left( \frac{(1)(2) + (0)(0) + (1)(0)}{|\mathbf{a}| \times |\mathbf{b}|} \right)

10.3 Pythonic Implementation

Use numpy.arccos() or scipy.arccos() for calculating angles between vectors in Python.

11. Vector Space and Subspace

11.1 Definition

A vector space is a non-empty set of vectors equipped with two operations—addition and scalar multiplication—satisfying eight axioms.

11.2 Subspace Conditions

A non-empty subset WW of vector space VV is a subspace if:

  1. For all u,v∈Wu, v \in W, then u+v∈Wu + v \in W.

  2. For any scalar aa and u∈Wu \in W, then au∈Wau \in W.

11.3 Examples of Subspaces

  • Example 11.1: Let W = \left{ \begin{pmatrix} x\ y \end{pmatrix} \; | \; x,y \text{ are constants} \right} \; \cup \; {(0,0)}

11.4 Linear Combination and Spanning Set

A linear combination of vectors u1,u2, and u3u_1, u_2, \text{ and } u_3 in vectors space VV is given by:
v=c1u1+c2u2+c3u3v = c_1 u_1 + c_2 u_2 + c_3 u_3, where c1,c2,c3c_1, c_2, c_3 are scalars.

Example of Linear Combination

Express vector a=(8,13)\text{vector } a = (8,13) as a combination of two other vectors.

11.5 Linear Independence

A set of vectors is linearly independent if the only solution to the equation
c1u1+c2u2+…+cnun=0c_1 u_1 + c_2 u_2 + … + c_n u_n = 0 is c1=c2=…=cn=0c_1 = c_2 = … = c_n = 0.

11.6 Basis of a Vector Space

A basis of a vector space consists of linearly independent vectors that span the space. For instance, the standard basis for R3\mathbb{R}^3 is given as the vectors i,j,k\mathbf{i}, \mathbf{j}, \mathbf{k}.

11.7 Dimension of a Vector Space

The dimension dim(V)\text{dim}(V) of a vector space is the number of vectors in a basis of VV.

11.8 Inner Product Space

An inner product space generalizes the dot product concept and defines a product between two vectors that results in a scalar:
uTv=u1v1+u2v2+…+unvnu^T v = u_1 v_1 + u_2 v_2 + … + u_n v_n.

11.9 Orthogonal and Orthonormal Bases

A set of vectors is called orthogonal if each pair is orthogonal, and orthonormal if they are also unit vectors. A framework can be adjusted to orthogonalize vectors using the Gram-Schmidt process.

12. Conclusion

All concepts discussed form the foundational principles for understanding Vectors in 3D Space. Proper knowledge of operations, properties, and their applications is crucial in both mathematics and physics contexts. The introduction of programming using libraries such as Python enhances the applicability of these mathematical concepts in computational environments. The importance of coding practices in numerical and symbolic calculations cannot be understated, offering efficiency and accuracy in calculations involving vectors.