Selected topic

Vector Addition

Vector Operations

Prefer practical output? Use related tools below while reading.

In linear algebra, vectors are used to represent points or directions in a multidimensional space. Vector addition and various operations on vectors are essential concepts that allow us to manipulate these geometric objects.

### Basic Operations

The following are the basic operations performed on vectors:

  • Scalar Multiplication: A scalar (a number) is multiplied by each component of a vector.
  • Vector Addition: Two or more vectors are added together by adding their corresponding components.
  • Subtraction: The difference between two vectors is found by subtracting one vector from another.
### Example: Vector Addition

Suppose we have two vectors $\mathbf{a} = \begin{bmatrix} 2 \\ 3 \end{bmatrix}$ and $\mathbf{b} = \begin{bmatrix} -1 \\ 4 \end{bmatrix}$. We can add these vectors together by adding their corresponding components:

$$\mathbf{a} + \mathbf{b} = \begin{bmatrix} 2 \\ 3 \end{bmatrix} + \begin{bmatrix} -1 \\ 4 \end{bmatrix} = \begin{bmatrix} 1 \\ 7 \end{bmatrix}$$

### Code Implementation (Python)

Here is an example code snippet that performs vector addition using Python:

python
import numpy as np

# Define two vectors
a = np.array([2, 3])
b = np.array([-1, 4])

# Add the vectors together
result = a + b

print(result) # Output: [1 7]

In this code snippet, we use the NumPy library to create arrays representing our vectors. We then perform vector addition using the + operator and print the result.

Note that this is a simplified example and in practice you would work with higher dimensional vectors and more complex operations.