Skip to main content

Appendix 1 — Mathematics for Data Science I - Formula Sheet

No.TopicFormula / Key Result
1Natural numbersN=0,1,2,…\mathbb{N}={0,1,2,\ldots}
2IntegersZ=…,−2,−1,0,1,2,…\mathbb{Z}={\ldots,-2,-1,0,1,2,\ldots}
3Rational numbersQ={pq:p,q∈Z, q≠0}\mathbb{Q}=\left\{\frac{p}{q}:p,q\in\mathbb{Z},\ q\neq0\right\}
4Real numbersR=Q∪irrational numbers\mathbb{R}=\mathbb{Q}\cup{\text{irrational numbers}}
5UnionA∪BA\cup B
6IntersectionA∩BA\cap B
7DifferenceA−BA-B
8ComplementAcA^c
9De Morgan's law(A∪B)c=Ac∩Bc(A\cup B)^c=A^c\cap B^c
10De Morgan's law(A∩B)c=Ac∪Bc(A\cap B)^c=A^c\cup B^c
11Cardinality∣A∪B∣=∣A∣+∣B∣−∣A∩B∣\lvert A\cup B\rvert=\lvert A\rvert+\lvert B\rvert-\lvert A\cap B\rvert
12Cartesian productA×B=(a,b):a∈A,b∈BA\times B={(a,b):a\in A,b\in B}
13Functionf:A→Bf:A\to B
14Composition(f∘g)(x)=f(g(x))(f\circ g)(x)=f(g(x))
15Injectivef(x1)=f(x2)⇒x1=x2f(x_1)=f(x_2)\Rightarrow x_1=x_2
16SurjectiveRange(f)=B\text{Range}(f)=B
17BijectiveInjective and surjective
18Inversef−1(f(x))=xf^{-1}(f(x))=x
19Distanced=(x2−x1)2+(y2−y1)2d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
20MidpointM=(x1+x22,y1+y22)M=\left(\frac{x_1+x_2}{2},\frac{y_1+y_2}{2}\right)
21Slopem=y2−y1x2−x1m=\frac{y_2-y_1}{x_2-x_1}
22Slope-intercept formy=mx+cy=mx+c
23Point-slope formy−y1=m(x−x1)y-y_1=m(x-x_1)
24Two-point formy−y1=y2−y1x2−x1(x−x1)y-y_1=\frac{y_2-y_1}{x_2-x_1}(x-x_1)
25Intercept formxa+yb=1\frac{x}{a}+\frac{y}{b}=1
26General lineAx+By+C=0Ax+By+C=0
27Parallel linesm1=m2m_1=m_2
28Perpendicular linesm1m2=−1m_1m_2=-1
29Point-line distanced=∣Ax0+By0+C∣A2+B2\displaystyle d=\frac{\lvert Ax_0+By_0+C\rvert}{\sqrt{A^2+B^2}}
30Quadraticf(x)=ax2+bx+cf(x)=ax^2+bx+c
31DiscriminantΔ=b2−4ac\Delta=b^2-4ac
32Quadratic formulax=−b±b2−4ac2a\displaystyle x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
33Vertexxv=−b2a,yv=f(xv)x_v=-\frac{b}{2a},\quad y_v=f(x_v)
34Axis of symmetryx=−b2ax=-\frac{b}{2a}
35Sum of rootsr1+r2=−bar_1+r_2=-\frac{b}{a}
36Product of rootsr1r2=car_1r_2=\frac{c}{a}
37PolynomialP(x)=anxn+⋯+a1x+a0P(x)=a_nx^n+\cdots+a_1x+a_0
38Polynomial degreedeg⁡(P)=n\deg(P)=n
39Remainder theoremRemainder on division by x−ax-a is P(a)P(a)
40Factor theoremP(a)=0  ⟺  (x−a)P(a)=0\iff(x-a) is a factor
41Polynomial rootP(r)=0P(r)=0
42Maximum turning pointsn−1n-1 for a polynomial of degree nn
43Exponential functionf(x)=ax,a>0, a≠1f(x)=a^x,\quad a>0,\ a\neq1
44Product of powersaman=am+na^ma^n=a^{m+n}
45Quotient of powersaman=am−n\frac{a^m}{a^n}=a^{m-n}
46Power of a power(am)n=amn(a^m)^n=a^{mn}
47Negative exponenta−n=1ana^{-n}=\frac{1}{a^n}
48Zero exponenta0=1a^0=1
49Logarithm definitionlog⁡ax=y  ⟺  ay=x\log_a x=y\iff a^y=x
50Product rulelog⁡a(xy)=log⁡ax+log⁡ay\log_a(xy)=\log_a x+\log_a y
51Quotient rulelog⁡a(xy)=log⁡ax−log⁡ay\log_a\left(\frac{x}{y}\right)=\log_a x-\log_a y
52Power rulelog⁡a(xr)=rlog⁡ax\log_a(x^r)=r\log_a x
53Change of baselog⁡ax=ln⁡xln⁡a\log_a x=\frac{\ln x}{\ln a}
54Natural logarithmln⁡x=log⁡ex\ln x=\log_e x
55Logarithm of onelog⁡a1=0\log_a1=0
56Logarithm of baselog⁡aa=1\log_a a=1
57Sequence limitlim⁡n→∞an=L\displaystyle\lim_{n\to\infty}a_n=L
58Reciprocal limitlim⁡n→∞1nk=0\displaystyle\lim_{n\to\infty}\frac{1}{n^k}=0
59Function limitlim⁡x→af(x)=L\displaystyle\lim_{x\to a}f(x)=L
60Left-hand limitlim⁡x→a−f(x)\displaystyle\lim_{x\to a^-}f(x)
61Right-hand limitlim⁡x→a+f(x)\displaystyle\lim_{x\to a^+}f(x)
62Limit existencelim⁡x→a−f(x)=lim⁡x→a+f(x)\displaystyle\lim_{x\to a^-}f(x)=\lim_{x\to a^+}f(x)
63Continuitylim⁡x→af(x)=f(a)\displaystyle\lim_{x\to a}f(x)=f(a)
64Derivative definitionf′(a)=lim⁡h→0f(a+h)−f(a)h\displaystyle f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}
65Constant ruleddx(c)=0\frac{d}{dx}(c)=0
66Power ruleddx(xn)=nxn−1\frac{d}{dx}(x^n)=nx^{n-1}
67Sum rule(f+g)′=f′+g′(f+g)'=f'+g'
68Difference rule(f−g)′=f′−g′(f-g)'=f'-g'
69Product rule(fg)′=f′g+fg′(fg)'=f'g+fg'
70Quotient rule(fg)′=gf′−fg′g2\displaystyle\left(\frac{f}{g}\right)'=\frac{gf'-fg'}{g^2}
71Chain rule(f(g(x)))′=f′(g(x))g′(x)(f(g(x)))'=f'(g(x))g'(x)
72Exponential derivativeddxex=ex\frac{d}{dx}e^x=e^x
73General exponential derivativeddxax=axln⁡a\frac{d}{dx}a^x=a^x\ln a
74Logarithmic derivativeddxln⁡x=1x\displaystyle\frac{d}{dx}\ln x=\frac{1}{x}
75Tangent slopem=f′(a)m=f'(a)
76Tangent liney−f(a)=f′(a)(x−a)y-f(a)=f'(a)(x-a)
77Linear approximationL(x)=f(a)+f′(a)(x−a)L(x)=f(a)+f'(a)(x-a)
78Critical pointf′(c)=0f'(c)=0 or f′(c)f'(c) does not exist
79Second derivative testf′′(c)<0f''(c)<0: local maximum
80Second derivative testf′′(c)>0f''(c)>0: local minimum
81L'Hôpital's rulelim⁡x→af(x)g(x)=lim⁡x→af′(x)g′(x)\displaystyle\lim_{x\to a}\frac{f(x)}{g(x)}=\lim_{x\to a}\frac{f'(x)}{g'(x)}
82Indefinite integral∫f(x),dx=F(x)+C\displaystyle\int f(x),dx=F(x)+C
83Constant integral∫c,dx=cx+C\displaystyle\int c,dx=cx+C
84Power integral∫xn,dx=xn+1n+1+C,n≠−1\displaystyle\int x^n,dx=\frac{x^{n+1}}{n+1}+C,\quad n\neq-1
85Constant multiple∫cf(x),dx=c∫f(x),dx\displaystyle\int cf(x),dx=c\int f(x),dx
86Sum integral∫(f+g),dx=∫f,dx+∫g,dx\displaystyle\int(f+g),dx=\int f,dx+\int g,dx
87Definite integral∫abf(x),dx\displaystyle\int_a^b f(x),dx
88Fundamental Theorem∫abf(x),dx=F(b)−F(a)\displaystyle\int_a^b f(x),dx=F(b)-F(a)
89Accumulation functionF(x)=∫axf(t),dt\displaystyle F(x)=\int_a^x f(t),dt
90Accumulation derivativeF′(x)=f(x)F'(x)=f(x)
91Exponential integral∫ex,dx=ex+C\displaystyle\int e^x,dx=e^x+C
92General exponential integral∫ax,dx=axln⁡a+C\displaystyle\int a^x,dx=\frac{a^x}{\ln a}+C
93Logarithmic integral∫1x,dx=ln⁡∣x∣+C\displaystyle\int\frac{1}{x},dx=\ln\lvert x\rvert+C
94Area under curveA=∫abf(x),dx\displaystyle A=\int_a^b f(x),dx
95GraphG=(V,E)G=(V,E)
96Undirected edgeu,v{u,v}
97Directed edge(u,v)(u,v)
98Vertex degreedeg⁡(v)\deg(v)
99Adjacency matrixAij=1A_{ij}=1 if edge i→ji\to j exists
100BFS structureQueue (FIFO)
101DFS structureStack / recursion (LIFO)
102BFS complexityO(∣V∣+∣E∣)O(\lvert V\rvert+\lvert E\rvert)
103DFS complexityO(∣V∣+∣E∣)O(\lvert V\rvert+\lvert E\rvert)
104DAGDirected graph with no directed cycle
105Topological orderinguu appears before vv for every u→vu\to v
106Topological sorting complexityO(∣V∣+∣E∣)O(\lvert V\rvert+\lvert E\rvert)
107Matrix multiplicationCij=∑kAikBkj\displaystyle C_{ij}=\sum_k A_{ik}B_{kj}
108Path weight∑e∈Pw(e)\displaystyle\sum_{e\in P}w(e)
109Relaxationd[v]=min⁡(d[v],d[u]+w(u,v))\displaystyle d[v]=\min(d[v],d[u]+w(u,v))
110Longest-path relaxationd[v]=max⁡(d[v],d[u]+w(u,v))\displaystyle d[v]=\max(d[v],d[u]+w(u,v))
111Dijkstra initializationd[s]=0,d[v]=∞d[s]=0,\quad d[v]=\infty
112Dijkstra conditionNon-negative edge weights
113Dijkstra complexityO((∣V∣+∣E∣)log⁡∣V∣)O((\lvert V\rvert+\lvert E\rvert)\log\lvert V\rvert)
114Bellman-Ford passes∣V∣−1\lvert V\rvert-1
115Bellman-Ford complexityO(∣V∣∣E∣)O(\lvert V\rvert\lvert E\rvert)
116Floyd-Warshall recurrenceDij=min⁡(Dij,Dik+Dkj)D_{ij}=\min(D_{ij},D_{ik}+D_{kj})
117Floyd-Warshall complexityO(∣V∣3)O(\lvert V\rvert^3)
118Spanning tree edges∣V∣−1\lvert V\rvert-1
119MST objectivemin⁡∑e∈Tw(e)\displaystyle\min\sum_{e\in T}w(e)
120Prim complexityO((∣V∣+∣E∣)log⁡∣V∣)O((\lvert V\rvert+\lvert E\rvert)\log\lvert V\rvert)
121Kruskal orderingProcess edges in increasing weight
122Kruskal complexityO(∣E∣log⁡∣E∣)O(\lvert E\rvert\log\lvert E\rvert)