Math for Computer Science

by Yukong Zhang

Level 0



Pythagorean Theorem

\[ c^2=a^2+b^2 \\ c=\sqrt{a^2+b^2} \]


Circle

\[ Area=\pi r^2 \] \[ Circumference=2 \pi r \]


Roots of quadratic equation

\[ ax^2+bx+c=0 \\ b^2-4ac >= 0 \\ x_1 = \frac{-b+\sqrt{b^2-4ac}}{2a}\\ x_2 = \frac{-b-\sqrt{b^2-4ac}}{2a} \]


Exponents

\[ \begin{aligned} a^n & = a \times a \dots \times a \\ a^0 & = 1 \\ a^{-n} & = \frac{1}{a^n} \\ a^r \times a^s & = a^{r+s} \\ \frac{a^r}{a^s} & = a^{r-s} \\ (a^r)^s & = a^{rs} \\ (ab)^r & = a^rb^r \\ (\frac{a}{b})^r & = \frac{a^r}{b^r} \\ \end{aligned} \]


Logarithm

\[ log_2 N = M \\ 2^M=N \]


Average and Weighted Average

\[ \bar a = \frac{a_1+a_2+\dots+a_n}{n}=\frac{1}{n} \sum_{k=1}^n a_k \\ \bar a_w = w_1 a_1+w_2 a_2+\dots+w_n a_n=\sum_{k=1}^n w_k a_k \\ w_1+w_2+\dots+w_n = 1 =100\% \]


Combination and Permutation

\[ C(n, k) = {n \choose k} = \frac{n!}{k!(n-k)!} \\ P(n, k) = \frac{n!}{(n-k)!} \]