Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Introductions to Vectors | Linear Algebra Foundations
Mathematics for Data Science

bookIntroductions to Vectors

Vectors are fundamental in math, physics, and data science. They allow you to represent direction, magnitude, and position in space. In data science, vectors are used to represent data points, features, model weights, and more.

By understanding vectors and their operations, you can compute distances, compare directions, and build machine learning algorithms.

What Is a Vector?

A vector is an ordered pair of numbers with both magnitude and direction.

v=(x,y)\vec{v} = (x,y)

Vectors are often drawn as arrows from the origin to a point in space. Two vectors are considered equal if they have the same direction and length, even if they start at different locations.

The Zero Vector

The zero vector has no length and no direction. It is written as:

0=(0,0)\vec{0} = (0, 0)

Vector Addition and Subtraction

Addition

To add two vectors, add their corresponding components:

a+b=(a1+b1,  a2+b2)\vec{a} + \vec{b} = (a_1 + b_1, \; a_2 + b_2)

You can visualize this with:

  • Head-to-tail method: move the tail of one vector to the head of the other;
  • Parallelogram method: both vectors start from the same point and form a parallelogram.

Subtraction

To subtract one vector from another:

ab=(a1b1,  a2b2)\vec{a} - \vec{b} = (a_1 - b_1, \; a_2 - b_2)

This gives a new vector pointing from the head of the second to the head of the first.

Scalar Multiplication

Multiplying a vector by a number (a scalar) stretches or flips the vector:

ka=(ka1,  ka2)k \cdot \vec{a} = (k \cdot a_1, \; k \cdot a_2)
  • If k>1k > 1, the vector is stretched in the same direction;
  • If 0<k<10 < k < 1, the vector is shrunk;
  • If k<0k < 0, it flips direction;
  • If k=0k = 0, it becomes the zero vector.

Vector Magnitude (Length)

The magnitude or length of a vector is calculated with the Pythagorean theorem:

a=a12+a22|\vec{a}| = \sqrt{a_1^2 + a_2^2}

This gives the straight-line distance from the origin to the tip of the vector.

The Dot Product

The dot product combines two vectors into a single number that reflects how aligned they are:

ab=a1b1+a2b2\vec{a} \cdot \vec{b} = a_1 b_1 + a_2 b_2
  • If the result is positive: the vectors point in a similar direction;
  • If the result is zero: the vectors are perpendicular;
  • If the result is negative: they point in opposite directions.

Example

If a=(1,2)  and  b=(3,4) \vec{a} = (1, 2)\ \ \text{and}\ \ \vec{b} = (3, 4), then:

ab=13+24=11\vec{a} \cdot \vec{b} = 1 \cdot 3 + 2 \cdot 4 = 11

1. What is the result of:

(2,3)+(4,5)(2, 3) + (4, 5)

2. What is the magnitude of (3,4)(3, 4)

3. Which statement is true about the dot product?

4. If a=(1,0), b=(0,1)\vec{a} = (1, 0),\ \vec{b} = (0, 1). Then their dot product is:

question mark

What is the result of:

(2,3)+(4,5)(2, 3) + (4, 5)

Select the correct answer

question mark

What is the magnitude of (3,4)(3, 4)

Select the correct answer

question mark

Which statement is true about the dot product?

Select the correct answer

question mark

If a=(1,0), b=(0,1)\vec{a} = (1, 0),\ \vec{b} = (0, 1). Then their dot product is:

Select the correct answer

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 1

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Suggested prompts:

Can you explain the difference between the head-to-tail and parallelogram methods for vector addition?

How do you use the Pythagorean theorem to find the magnitude of a vector?

Can you give more examples of vector addition and subtraction?

Awesome!

Completion rate improved to 1.89

bookIntroductions to Vectors

Desliza para mostrar el menú

Vectors are fundamental in math, physics, and data science. They allow you to represent direction, magnitude, and position in space. In data science, vectors are used to represent data points, features, model weights, and more.

By understanding vectors and their operations, you can compute distances, compare directions, and build machine learning algorithms.

What Is a Vector?

A vector is an ordered pair of numbers with both magnitude and direction.

v=(x,y)\vec{v} = (x,y)

Vectors are often drawn as arrows from the origin to a point in space. Two vectors are considered equal if they have the same direction and length, even if they start at different locations.

The Zero Vector

The zero vector has no length and no direction. It is written as:

0=(0,0)\vec{0} = (0, 0)

Vector Addition and Subtraction

Addition

To add two vectors, add their corresponding components:

a+b=(a1+b1,  a2+b2)\vec{a} + \vec{b} = (a_1 + b_1, \; a_2 + b_2)

You can visualize this with:

  • Head-to-tail method: move the tail of one vector to the head of the other;
  • Parallelogram method: both vectors start from the same point and form a parallelogram.

Subtraction

To subtract one vector from another:

ab=(a1b1,  a2b2)\vec{a} - \vec{b} = (a_1 - b_1, \; a_2 - b_2)

This gives a new vector pointing from the head of the second to the head of the first.

Scalar Multiplication

Multiplying a vector by a number (a scalar) stretches or flips the vector:

ka=(ka1,  ka2)k \cdot \vec{a} = (k \cdot a_1, \; k \cdot a_2)
  • If k>1k > 1, the vector is stretched in the same direction;
  • If 0<k<10 < k < 1, the vector is shrunk;
  • If k<0k < 0, it flips direction;
  • If k=0k = 0, it becomes the zero vector.

Vector Magnitude (Length)

The magnitude or length of a vector is calculated with the Pythagorean theorem:

a=a12+a22|\vec{a}| = \sqrt{a_1^2 + a_2^2}

This gives the straight-line distance from the origin to the tip of the vector.

The Dot Product

The dot product combines two vectors into a single number that reflects how aligned they are:

ab=a1b1+a2b2\vec{a} \cdot \vec{b} = a_1 b_1 + a_2 b_2
  • If the result is positive: the vectors point in a similar direction;
  • If the result is zero: the vectors are perpendicular;
  • If the result is negative: they point in opposite directions.

Example

If a=(1,2)  and  b=(3,4) \vec{a} = (1, 2)\ \ \text{and}\ \ \vec{b} = (3, 4), then:

ab=13+24=11\vec{a} \cdot \vec{b} = 1 \cdot 3 + 2 \cdot 4 = 11

1. What is the result of:

(2,3)+(4,5)(2, 3) + (4, 5)

2. What is the magnitude of (3,4)(3, 4)

3. Which statement is true about the dot product?

4. If a=(1,0), b=(0,1)\vec{a} = (1, 0),\ \vec{b} = (0, 1). Then their dot product is:

question mark

What is the result of:

(2,3)+(4,5)(2, 3) + (4, 5)

Select the correct answer

question mark

What is the magnitude of (3,4)(3, 4)

Select the correct answer

question mark

Which statement is true about the dot product?

Select the correct answer

question mark

If a=(1,0), b=(0,1)\vec{a} = (1, 0),\ \vec{b} = (0, 1). Then their dot product is:

Select the correct answer

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 1
some-alt