COMPSCI 120:
Mathematics for Computer Science

Expected Background Knowledge

We are assuming that students entering this paper are relatively mathematically confident, having done well in NCEA Level 3 mathematics. To be precise: we’re hoping that you’ve received a ‘merit’ or higher on one of the three externally-assessed NCEA L3 mathematics standards, namely differentiation, integration, or complex numbers.

In other systems, this is roughly equivalent to a passing mark in CIE A2 mathematics, or a C or better in CIE AS mathematics, or a 3/7 or higher in IB mathematics.

Compsci 120 is a paper that assumes you are already comfortable with a number of mathematical concepts and conventions. Trying to take this course without a solid background in mathematics is a bad idea. If you do not have this background, you should take Maths 102! Maths 102 is a course ran every semester (including summer semesters) at the University of Auckland, and has no prerequisites. It is designed to give you the skills to succeed in CS 120!

By “comfortable with”, we mean that you should be able to see these calculations done in lecture without further explanation, and be able perform these calculations yourself on an exam without a calculator.

To help clarify some of the specific concepts we’re expecting students to understand (in case you’re coming from overseas, or it’s been a while since you finished high school), here is a particular set of skills that we are hoping you’ve acquired over your career. This list is not exhaustive, but is just meant to point out the most common stumbling blocks that less-prepared students encounter in Compsci 120. Again, if you do not feel comfortable with these calculations, please enrol in Maths 102!

25=22222=322^5 = 2 \cdot 2 \cdot 2 \cdot 2 \cdot 2 = 32
2324=23+4=27=1282^3 \cdot 2^4 = 2^{3+4} = 2^{7} = 128
(22)3=223=26=64(2^2)^3 = 2^{2\cdot 3} = 2^6 = 64
72=172=1497^{-2} = \dfrac{1}{7^2} = \dfrac{1}{49}
100=110^0 = 1
abac=ab+ca^b \cdot a^c = a^{b+c}
(ab)c=abc(a^b)^c = a^{bc}
ab=1aba^{-b} = \dfrac{1}{a^b}
log2(32)=log2(25)=5\log_2(32) = \log_2\left( 2^5\right) = 5 log10(1)=0\log_{10}(1) = 0 log2(2n)=n\log_2(2^n) = n log2(a)=a\log_2(a) = a

Quiz .

What is log2(4n)log10(2n5n102n)\log_2(4^n) - \log_{10}\left(\dfrac{2^n5^n}{10^{2n}}\right) ?

(x+1)3=x3+3x2+3x+1(x+1)^3 = x^3 + 3x^2 + 3x + 1 (xy)(xn+xn1y+xn2y2++xyn1+yn)=xn+1+xny+xn1y2++xynxnyxn1y2xynyn1=xn+1yn+1(x -y)(x^n + x^{n-1}y + x^{n-2}y^2 + \ldots + xy^{n-1} + y^n) = x^{n+1} + x^n y + x^{n-1}y^2 + \ldots + xy^n - x^ny - x^{n-1}y^2 - \ldots - xy^n - y^{n-1} = x^{n+1} - y^{n+1}
1348=18+(4)324=424\dfrac{1}{3}-\dfrac{4}{8} = \dfrac{1\cdot 8 +(-4)\cdot 3}{24}=-\dfrac{4}{24}

3+7113=1133+7113=3461133+\dfrac{7}{113} = \dfrac{113 \cdot 3 +7}{113}=\dfrac{346}{113}

11x=1+x+x1x=1+x1x\dfrac{1}{1-x} = \dfrac{ 1 + -x + x}{1-x} = 1 + \dfrac{x}{1-x}
(4511)(56)=(45)(5)116=22566\left(-\dfrac{45}{11}\right) \cdot \left(-\dfrac{5}{6}\right) = \dfrac{(-45) \cdot (-5) }{ 11\cdot 6 }=\dfrac{225}{66}

ab+dbc=ac+dbc\dfrac{a}{b} + \dfrac{d}{bc} = \dfrac{ac + d}{bc}

1xa=1xax+ax+a=x+axa2\dfrac{1}{\sqrt{x} - a} = \dfrac{1}{\sqrt{x} - a} \cdot \dfrac{\sqrt{x}+a}{\sqrt{x} + a} = \dfrac{\sqrt{x} + a}{x - a^2}
3x4=123x=16x=1633x - 4 = 12 \Rightarrow 3x = 16 \Rightarrow x = \frac{16}{3}

(a21)b+1=a(a21)b=a1b=a1a21=1a+1, if a±1(a^2-1)b + 1 =a \Rightarrow (a^2-1)b = a-1 \Rightarrow b = \frac{a-1}{a^2-1} = \frac{1}{a+1}, \textrm{ if } a \neq \pm 1

5x735x10x2-5x - 7 \leq 3 \Rightarrow -5x \leq 10 \Rightarrow x \geq -2

20x2+1>2x2+120<12x2+1<10x<3\frac{20}{x^2+1} > 2 \Rightarrow \frac{x^2+1}{20} < \frac{1}{2} \Rightarrow x^2+1 < 10 \Rightarrow |x| < 3

x23x+2>0(x2)(x1)>0(x2) and (x1) are both <0, or (x2) and (x1) are both >0(x<2 and x<1), or (x>2 and x>1)(x<1) or (x>2).x^2 - 3x + 2 > 0 \Rightarrow (x-2)(x-1) > 0 \\ \Rightarrow (x-2) \textrm{ and } (x-1) \textrm{ are} \textrm{ both } < 0, \textrm{ or } (x-2) \textrm{ and } (x-1) \textrm{ are both } > 0\\ \Rightarrow (x < 2 \textrm{ and } x< 1), \textrm{ or } (x >2 \textrm{ and } x > 1)\\ \Rightarrow (x< 1) \textrm{ or } (x >2).
If f(x)=x2+1 then f(4)=42+1=17, and f(x+1)=(x+1)2+1=x2+2x+2.\textrm{If } f(x) = x^2 + 1\quad \textrm{ then }\quad f(4) = 4^2+1 = 17, \quad \textrm{ and }\quad f(x+1) = (x+1)^2 + 1 = x^2 + 2x + 2.

If g(n)=n(n+1)2 then g(n+1)=(n+1)(n+2)2, and g(2n)=(2n)(2n+1)2=n(2n+1).\textrm{If } g(n) = \frac{n(n+1)}{2}\quad\textrm{ then }\quad g(n+1) = \frac{(n+1)(n+2)}{2}, \quad\textrm{ and }\quad g(2n) = \frac{(2n)(2n+1)}{2} = n(2n+1).

If h(x)=1x then h(y)=1y, and h(h(y))=h(1y)=1(1y)=y.\textrm{If } h(x) = 1-x\quad\textrm{ then }\quad h(y) = 1-y, \quad\textrm{ and }\quad h(h(y)) = h(1-y) = 1- (1-y) = y.