Videos (~20 minutes)
Reading (~30 minutes)
Warmup (~50 mins)
Problem 1
At the end of this course, every student will receive a letter grade. Consider the relation of the form \((\mathrm{Student}, \mathrm{Grade})\). Here are some example entries of this relation:
\[ \begin{aligned} &(\mathrm{Xenith} ,&\quad B+&) \\ &(\mathrm{Grace} ,&\quad A\phantom{+}&) \\ &(\mathrm{Eun} ,& \quad B-&) \\ &(\mathrm{Natasha} ,&\quad A-&) \\ \vdots \end{aligned} \]
Part A
Explain why this relation is a function. Then, describe the sets that are its domain and codomain.
Part B
Is this function injective, surjective, or bijective? For each, state either “definitely,” “definitely not,” or “it depends.” Explain your answer in each case.
Problem 2
For each of the following situations:
- Write a recursive definition for a function \(f\) that describes the specified quantity. Please include the initial condition!!
- Carefully describe the domain and codomain of \(f\).
Part A
You place \(C\) dollars into a bank with an interest rate of \(k\%\). This means that your money grows by a factor of \(1 + \frac{k}{100}\) each year. The function \(f(n)\) describes the amount of money in your account after \(n\) years.
Part B
You are running 4 times a week to improve your endurance. You start being able to run 1 mile without stopping. Each week, you are able to run \(\frac{1}{10}\) of a mile longer without stopping. The function \(f(n)\) describes the distance you can run without stopping after week \(n\).
Part C
The factorial function \(f(n) = n!\) computes the product of all integers from \(1\) to \(n\). For example, \(5! = 1 \times 2 \times 3 \times 4 \times 5 = 120\).
Problem 3
Consider the function \(f:\mathbb{N} \rightarrow \mathbb{N}\) given by \(f(1) = 1\) and \(f(n) = f(n-1) + n - 1\).
- Compute \(f(4)\) by hand.
- Write a recursive function in either Python or Java that implements this function. Use it to compute \(f(4)\) and check that you got the same result.
© Phil Chodrow, 2023