Exercises

These exercises check whether you can read notation and translate it into meaning.

Try each prompt before opening the hint or solution.

MATH-C01-C-001Exercise: Substitute into an expression

If x=6x = 6, compute:

3x23x - 2

Compute it first, then check your number.

HintSubstitute first

Replace xx with 6. Multiply before subtracting.

SolutionSubstitute and simplify

Given x=6x = 6:

3x2=362=182=163x - 2 = 3 \cdot 6 - 2 = 18 - 2 = 16

The important step is substitution: replace the name xx with the value it names, then do the arithmetic.

MATH-C01-C-002Exercise: Evaluate a function

Let

g(t)=t2tg(t) = t^2 - t

Compute g(5)g(5).

Compute it first, then check your number.

HintUse 5 as the input

The notation g(5)g(5) means use 5 as the input. Replace every tt with 5.

SolutionEvaluate the function

Use 5 as the input:

g(5)=525=255=20g(5) = 5^2 - 5 = 25 - 5 = 20

The notation g(5)g(5) is a function call. It means run the same rule with 5 as the input.

MATH-C01-C-003Exercise: Read set membership

Let

Y={cat,dog,bird}Y = \{\text{cat}, \text{dog}, \text{bird}\}

Enter 1 if catY\text{cat} \in Y means cat is one of the allowed labels.

Compute it first, then check your number.

HintRead the symbol

The symbol \in means "is in".

SolutionMembership sentence

Enter 1. The statement means cat is a member of the set YY.

In this label example, it means cat is one of the allowed labels.

MATH-C01-C-004Exercise: Use mathematical indexing

Let

z=(10,20,30,40)z = (10, 20, 30, 40)

Using mathematical indexing, what is z3z_3?

Compute it first, then check your number.

HintCount mathematically

In this chapter, mathematical indexing starts at 1: z1z_1 is the first item.

SolutionThird item

Using mathematical indexing:

z1=10,z2=20,z3=30,z4=40z_1 = 10,\quad z_2 = 20,\quad z_3 = 30,\quad z_4 = 40

So z3=30z_3 = 30. The subscript names the position in mathematical indexing; it is not multiplication by 3.

MATH-C01-C-005Exercise: Expand a summation

If a1=2a_1 = 2, a2=5a_2 = 5, and a3=8a_3 = 8, compute:

i=13ai\sum_{i=1}^{3} a_i

Compute it first, then check your number.

HintExpand first

Write the sum as a1+a2+a3a_1 + a_2 + a_3.

SolutionExpand and substitute

Expand the summation:

i=13ai=a1+a2+a3\sum_{i=1}^{3} a_i = a_1 + a_2 + a_3

Substitute the values:

2+5+8=152 + 5 + 8 = 15

The sigma notation is only a compact way to write this repeated addition.

MATH-C01-C-006Exercise: Read an average-loss expression

In

1ni=1ni\frac{1}{n}\sum_{i=1}^{n} \ell_i

enter 1 if the expression means "average the loss values."

Compute it first, then check your number.

HintRead inside out

First read the summation. Then read the factor 1n\frac{1}{n}.

SolutionAverage loss

The summation adds the loss values:

1+2++n\ell_1 + \ell_2 + \cdots + \ell_n

Multiplying by 1n\frac{1}{n} divides that total by n.

So the expression is the average loss over n examples.

MATH-C01-C-007Exercise: Separate indexing conventions

A reader says:

If x=(4,7,9)x = (4, 7, 9), then x2x_2 is 9 because Python uses zero-based indexing.

Enter the correct value of x2x_2 in mathematical indexing.

Compute it first, then check your number.

HintSeparate the conventions

In mathematical indexing, x1x_1 is the first item.

SolutionDo not mix indexing systems

In mathematical indexing, x1x_1 is the first item. So if

x=(4,7,9)x = (4, 7, 9)

then:

x1=4,x2=7,x3=9x_1 = 4,\quad x_2 = 7,\quad x_3 = 9

In Python, the second item is x[1], not x[2].

MATH-C01-C-008Exercise: Check vocabulary membership

A model accepts one token from the set

V={yes,no,maybe}V = \{\text{yes}, \text{no}, \text{maybe}\}

Enter 1 if yesV\text{yes} \in V is true.

Compute it first, then check your number.

HintRead membership

Ask whether yes is listed in the set.

SolutionVocabulary membership

Enter 1. The token yes appears in VV, so yesV\text{yes} \in V is true.

MATH-C01-C-009Exercise: Compute average loss

Three examples have losses 44, 66, and 88.

What is the average loss?

Compute it first, then check your number.

HintUse the average pattern

Average means total divided by count.

SolutionAverage
4+6+83=183=6\frac{4 + 6 + 8}{3} = \frac{18}{3} = 6

Average means total divided by count. Here the total is 18 and the count is 3, so the average loss is 6.

MATH-C01-C-010Exercise: Read formulas for meaning

Enter 1 if reading a formula aloud should include what the formula means in the problem, not only the names of the symbols.

Compute it first, then check your number.

HintThree layers

Symbol name, operation, meaning in context.

SolutionMeaning matters

Enter 1. A useful reading does not stop at "sigma" or "x sub i." It says what computation is being performed and what it means in the current problem.

After these exercises, use the revision notes to check the ideas before moving to vectors.