Free preview

95 lessons

Mathematical Foundations for ML

Free preview

Mathematical Foundations for ML · 95 lessons

Build the maths foundations that make ML click

No surprise gaps

Actually remember it

Skip what you know

One subscription. All learning paths included.

Our content is best on a larger screen

Curves given as xx in terms of yy

Lines with xx as the subject

Explanation

Most equations we graph have yy as the subject, such as y=mx+cy = mx + c or y=x2y = x^2. When yy is on its own, we choose values of xx, compute the matching values of yy and plot the points.

An equation can equally have xx as the subject, giving xx in terms of yy. Then we choose values of yy and compute xx. The graph is still the set of all points that satisfy the equation.

A line with xx as the subject could always be rearranged to have yy as the subject, unless it is vertical. Here we work with equations that have xx as the subject, because some curves cannot be written as a single equation with yy as the subject. The simplest such equations describe straight lines.

The line x=my+cx = my + c

Theorem

For numbers mm and cc, the graph of

x=my+cx = my + c

is a straight line.

  • It crosses the xx-axis at (c,0)(c, 0).
  • It rises from left to right if m>0m > 0 and falls if m<0m < 0.
  • If m=0m = 0, it is the vertical line x=cx = c.

The diagram below shows why, in four steps.

12345−1−2−3−4−51234−1−2−3−4
x
y

Step 1: Choose y, compute x

For the line x=2y+1, we choose values of y and compute x. Choosing y=−2, 1 and 2 gives x=−3, 3 and 5, so the points (−3,−2), (3,1) and (5,2) lie on the line.

Step 2: Where it crosses the x-axis

Every point on the x-axis has y=0. Putting y=0 gives x=1, so the line crosses at (1,0).

For x=my+c, putting y=0 leaves x=c, so the crossing point is (c,0).

Step 3: Which way it leans

Each step of 1 up in y moves x across by m, here 2 to the right. Since m>0, higher points lie further right, so the line rises from left to right, just as y=mx+c does when m>0.

When m<0, higher points lie further left, so the line falls.

Step 4: Change m and c

The further m is from 0, the further the line runs across for each step up, so the flatter it is. For y=mx+c it is the other way round.

Example

Graph the equation x=2y−4x = 2y - 4. Find where it crosses the xx-axis, say which way it leans, and plot it from a table of values.

Solution

Putting y=0y = 0 gives x=−4x = -4, so the line crosses the xx-axis at (−4,0)(-4, 0).

Here m=2m = 2 is positive, so the line rises from left to right.

We choose three values of yy and compute x=2y−4x = 2y - 4 for each.

yy001122
xx−4-4−2-200

We plot the points (−4,0)(-4, 0), (−2,1)(-2, 1) and (0,2)(0, 2) and join them with a straight line.

1234−1−2−3−4−5−612345−1−2−3−4−5
x
y
(−4,0)
(−2,1)
(0,2)

Practice questions

4 questions

Four graphs are shown below.

1
2
3
−1
−2
−3
1
2
3
−1
−2
−3
A
1
2
3
−1
−2
−3
1
2
3
−1
−2
−3
B
1
2
3
−1
−2
−3
1
2
3
−1
−2
−3
C
1
2
3
−1
−2
−3
1
2
3
−1
−2
−3
D

Which one is the graph of x=2y+1x = 2y + 1?

Select the correct answer:

+ 3 more questions

Sideways parabolas

Explanation

After lines, the next simplest equations with xx as the subject are those that square yy. The parabola y=x2y = x^2 opens upwards. Swapping the roles of xx and yy gives x=y2x = y^2, the same parabola turned on its side so that it opens to the right.

We graph it in the same way as a line with xx as the subject: we choose values of yy and compute xx.

Sideways parabola

Definition

For numbers aa and cc with a≠0a \neq 0, the graph of

x=ay2+cx = ay^2 + c

is a sideways parabola.

Which way a sideways parabola opens

Theorem

  • The sideways parabola x=ay2+cx = ay^2 + c opens to the right if a>0a > 0 and opens to the left if a<0a < 0.
  • Its turning point, the leftmost or rightmost point, is (c,0)(c, 0).
123456−1−2−3−4−5−61234−1−2−3−4
x
y

The blue curve is the graph of x=ay2+c, and the red point is its turning point. Move the sliders to change a and c.

x=y2
It opens to the right and its turning point is (0,0).

Example

Four curves are drawn below. Decide which one could be the graph of x=4−y2x = 4 - y^2, and give its turning point.

x
y
A
x
y
B
x
y
C
x
y
D

Solution

The equation has xx as its subject and the form x=ay2+cx = ay^2 + c, with a=−1a = -1 and c=4c = 4, so its graph is a sideways parabola.

Since a=−1<0a = -1 < 0, the parabola opens to the left. Its turning point is (c,0)=(4,0)(c, 0) = (4, 0), on the xx-axis to the right of the origin.

We check each curve against these two facts:

  • Curve AA opens to the right.
  • Curve BB opens downwards, with its turning point on the yy-axis, so it is the graph of an equation with yy as its subject.
  • Curve CC opens to the left, and its turning point lies on the xx-axis to the right of the origin.
  • Curve DD opens to the left, but its turning point lies to the left of the origin.

So curve CC could be the graph of x=4−y2x = 4 - y^2, and its turning point is (4,0)(4, 0).

Practice questions

4 questions

Four curves are drawn below.

x
y
A
x
y
B
x
y
C
x
y
D

Which one is the graph of x=y2x = y^2?

Select the correct answer:

+ 3 more questions

The same curve written both ways

Explanation

A line that is neither horizontal nor vertical can be rearranged into a single equation with the other variable as its subject. A parabola cannot: making the other variable its subject gives two equations, one for each half of the curve.

12345−1−2−3−4−5123456−1
x
y
y=2x−2

Step 1: A line gives one equation

The line y=2x−2 is also x=y2+1: adding 2 to both sides and dividing by 2 makes x the subject. Either way, one equation describes the whole line.

Step 2: One height gives two points

The line y=4 meets y=x2 at two points, where x2=4. This has two solutions, x=2 and x=−2. The positive one, 4, gives the point (2,4) on the right, and the negative one, −4, gives the point (−2,4) on the left.

Step 3: Each sign gives one half

The same holds at every height y above the turning point. So x=y gives the right half, and x=−y gives the left half.

Step 4: Both halves together

Together, the two equations x=±y give the whole parabola.

Step 5: A sideways parabola

Making y the subject of x=y2 gives y=±x: y=x is the upper half and y=−x is the lower half. So this curve cannot be written as a single equation with y as the subject.

Each of x=yx = \sqrt{y} and x=−yx = -\sqrt{y} describes one branch of the parabola - the part on one side of its turning point. Here they are the right and left branches, and a sideways parabola has an upper and a lower branch.

Making the other variable the subject of a parabola's equation

Procedure

  1. Rearrange the equation so that the square of the new subject stands alone on one side.
  2. Take the square root of the other side, with ±\pm in front.
  3. For one branch, keep one sign: ++ for the branch where the new subject is non-negative, and −- for the branch where it is non-positive.

Example

Which equation, with xx as the subject, names the left branch of y=x2+2y = x^2 + 2, where x≤0x \le 0?

Solution

We follow the three steps, with xx as the new subject.

  1. Subtracting 22 from both sides leaves the square of xx alone on one side:

    x2=y−2x^2 = y - 2
  2. Taking the square root of the other side, with ±\pm in front, gives

    x=±y−2x = \pm\sqrt{y - 2}
  3. The left branch is where x≤0x \le 0, so we keep the −- sign:

    x=−y−2x = -\sqrt{y - 2}

As a check, choosing y=6y = 6 gives x=−4=−2x = -\sqrt{4} = -2, and the point (−2,6)(-2, 6) lies on y=x2+2y = x^2 + 2 because (−2)2+2=6(-2)^2 + 2 = 6.

Practice questions

5 questions

Which equation, with xx as the subject, gives the same line as y=3x−6y = 3x - 6?

Select the correct answer:

+ 4 more questions