4D vector
In mathematics and computer science, a 4D vector (four-dimensional vector) is an ordered list of four numbers (components), often represented as (x, y, z, w), where x, y, z, and w are scalar values. These vectors exist within a four-dimensional vector space.
The properties and operations applicable to vectors in two-dimensional (2D) and three-dimensional (3D) spaces are generally extendable to 4D vectors. These operations include:
- Addition: Two 4D vectors can be added component-wise: (x1, y1, z1, w1) + (x2, y2, z2, w2) = (x1+x2, y1+y2, z1+z2, w1+w2).
- Scalar multiplication: A 4D vector can be multiplied by a scalar (a single number): k * (x, y, z, w) = (kx, ky, kz, kw).
- Dot product (inner product): The dot product of two 4D vectors is a scalar value: (x1, y1, z1, w1) · (x2, y2, z2, w2) = x1x2 + y1y2 + z1z2 + w1w2. The dot product can be used to determine the angle between two vectors or to project one vector onto another.
- Magnitude (length or norm): The magnitude of a 4D vector is calculated as the square root of the sum of the squares of its components: ||(x, y, z, w)|| = √(x² + y² + z² + w²).
Applications:
4D vectors find application in various fields:
- Computer Graphics and Game Development: Homogeneous coordinates in 3D graphics often use 4D vectors. The 'w' component allows for translations and perspective projections to be represented using matrix multiplication, simplifying transformations. They are also used in animation and simulations involving four degrees of freedom.
- Physics: In special relativity, spacetime is modeled as a four-dimensional manifold, with time as the fourth dimension. 4D vectors, known as four-vectors, are used to represent physical quantities like position and momentum in this context.
- Data Analysis and Machine Learning: In higher-dimensional data spaces, 4D vectors (and vectors of even higher dimensions) can represent data points, enabling mathematical operations for clustering, classification, and other analytical tasks. Feature vectors can have four components representing various characteristics of a data point.
- Mathematics: 4D vectors are fundamental to linear algebra and higher-dimensional geometry. They allow for representing points, directions, and transformations in four-dimensional space.