DDMA Level IIMathematical Concepts in Data Science
Chapters
Chapter 1

Linear algebra

Last updated November 2026about 4 min read

Key takeaways

  • A linear equation relates unknowns to constants through addition, subtraction and multiplication only, and a straight line can be written in general, slope-intercept, point-slope, intercept or two-point form.
  • In slope-intercept form, y = mx + c, m is the slope and c is the y-intercept.
  • A system of two linear equations in two unknowns is solved by substitution or elimination, and the answer is checked by substituting it back.
  • Vectors are added, subtracted and multiplied by a scalar component by component.
  • A unit vector has magnitude 1: divide a vector by its own magnitude and it keeps the same direction.

Linear algebra is the mathematical foundation most data science techniques are built on, from a simple trend line to the vector operations behind machine learning models.

A linear equation in one variable relates a single unknown to constants through addition, subtraction and multiplication only, e.g. 2x + 3 = 11. The equation of a line generalises this to two variables, describing every point that lies on a straight line.

Forms of a linear equation, each useful in a different situation:

General form
Ax + By + C = 0, the most flexible form.
Slope-intercept form
y = mx + c, where m is the slope and c is the y-intercept, the most common form for quick graphing.
Point-slope form
y - y1 = m(x - x1), useful when a point on the line and its slope are known.
Intercept form
x/a + y/b = 1, where a and b are the x- and y-intercepts.
Two-point form
(y - y1)/(y2 - y1) = (x - x1)/(x2 - x1), useful when two points on the line are known.

Solving a linear equation in one variable means isolating the unknown through inverse operations, applied to both sides equally. Solving in two variables usually means a system of two linear equations in two unknowns, solved by substitution or elimination.

Solving a system of two linear equations

2x + y = 10

x - y = 2

  1. (2x+y)+(x−y)=10+2(2x + y) + (x - y) = 10 + 2

    Add the two equations to eliminate y

  2. 3x=123x = 12

    so x = 4

  3. 4−y=24 - y = 2

    Substitute back, so y = 2

  4. 2(4)+2=102(4) + 2 = 10

    Check in the first equation

Vector operations, the building blocks of the multi-dimensional data structures most data science tools use internally:

Vector addition
Add corresponding components of two vectors: (a1, a2) + (b1, b2) = (a1+b1, a2+b2).
Vector subtraction
Subtract corresponding components: (a1, a2) - (b1, b2) = (a1-b1, a2-b2).
Scalar multiplication
Multiply every component of a vector by a single number.
Properties of vector addition and scalar multiplication
Addition is commutative and associative; scalar multiplication distributes over vector addition, the same algebraic rules ordinary numbers follow.
Unit vector
A vector with magnitude 1, found by dividing a vector by its own magnitude, pointing in the same direction as the original.

Vector addition, subtraction, scalar multiplication and unit vector

a = (3, 4), b = (1, 2)

a + b = (3+1, 4+2) = (4, 6)

a - b = (3-1, 4-2) = (2, 2)

2a = (2×3, 2×4) = (6, 8)

Magnitude of a: |a| = √(3² + 4²) = √25 = 5

Unit vector of a: (3/5, 4/5) = (0.6, 0.8)

Exam tip

Practise converting between the linear-equation forms (slope-intercept, point-slope, two-point, intercept), a question often gives you information in one form and asks for the equation in another.

Test Your Knowledge

3 questions on this chapter
Question 1 of 3Solve the system 3x + y = 14 and x - y = 2.
Pick an option first
Question 2 of 3What is the unit vector of a = (6, 8)?
Pick an option first
Question 3 of 3You know the slope of a line and one point that lies on it. Which form of a linear equation is designed for that situation?
Pick an option first