0% found this document useful (0 votes)
302 views

Theoretical Computer Science Cheat Sheet

1. This document provides definitions and formulas related to theoretical computer science concepts like asymptotic notation (O, Ω, o), limits, series, combinations, permutations, and more. 2. Asymptotic notation is used to describe how the runtime of an algorithm grows as the input size n increases. Common notations include f(n) = O(g(n)) meaning f grows no faster than g, and f(n) = Ω(g(n)) meaning f grows at least as fast as g. 3. Formulas are given for common series like geometric series and harmonic series, as well as combinations, permutations, and Stirling numbers related to counting problems.

Uploaded by

kamvakpras
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
302 views

Theoretical Computer Science Cheat Sheet

1. This document provides definitions and formulas related to theoretical computer science concepts like asymptotic notation (O, Ω, o), limits, series, combinations, permutations, and more. 2. Asymptotic notation is used to describe how the runtime of an algorithm grows as the input size n increases. Common notations include f(n) = O(g(n)) meaning f grows no faster than g, and f(n) = Ω(g(n)) meaning f grows at least as fast as g. 3. Formulas are given for common series like geometric series and harmonic series, as well as combinations, permutations, and Stirling numbers related to counting problems.

Uploaded by

kamvakpras
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Theoretical Computer Science Cheat Sheet

De nitions Series
f(n) = O(g(n)) i 9 positive c n0 such that X
n X
n + 1) X
n
i = n(n2+ 1) i2 = n(n + 1)(2n 3 = n (n + 1) :
2 2
0  f(n)  cg(n) 8n  n0. i
i=1 i=1 6 i=14
f(n) = (g(n)) i 9 positive c n0 such that In general:

f(n)  cg(n)  0 8n  n0.
X
n X
n ;
f(n) = (g(n)) i f(n) = O(g(n)) and m i = m 1+ 1 (n + 1)m+1 ; 1 ; (i + 1)m+1 ; im+1 ; (m + 1)im
f(n) = (g(n)). i=1
 
i=1
nX;1 X m+1
m
f(n) = o(g(n)) i limn!1 f(n)=g(n) = 0. im = m 1+ 1 k Bk nm+1;k :
lim a = a i 8 2 R, 9n0 such that i=1 k=0
n!1 n Geometric series:
jan ; aj < , 8n  n0.
Xn n+1 X
1 X
1
sup S least b 2 R such that b  s, ci = c c ;;1 1 c 6= 1 ci = 1 ;1 c ci = 1 ;c c c < 1
8s 2 S. i=0 i=0 i=1
X
n n n
nc ; (n + 1)c + c X
1
ici = (1 ;c c)2
+2 +1
inf S greatest b 2 R such that b  ici = c 6= 1 c < 1:
s, 8s 2 S. i=0 (c ; 1)2 i=0
lim inf a lim inf fai j i  n i 2 Ng. Harmonic series:
n!1 n n!1 X
n X
n
Hn = 1i iHi = n(n2+ 1) Hn ; n(n4; 1) :
lim sup an lim supfai j i  n i 2 Ng.
n!1 i=1 i=1
n!1
;n X
n Xn i  n + 1  
k Combinations: Size k sub- Hi = (n + 1)Hn ; n m Hi = m + 1 Hn+1 ; m 1+ 1 :
sets of a size n set. i=1 i=1
 n Stirling numbers (1st kind):   X n n n  n 
k n
1. k = (n ; k)!k! n! 2. n 3. k = n ; k
Arrangements of an n ele- k =2
ment set into k cycles. n  n
 n ;1
 k =0  n   n ;1
 n ; 1

n Stirling numbers (2nd kind): 4. k = k k ; 1 5. k = k + k ; 1
k
Partitions of an n element       X r + k r + n + 1
set into k non-empty sets. 6. mn mk = nk mn ;; kk 7. k = n
n 1st order Eulerian numbers:     k  n    
k X k
n n+1 X r s
n r+s
Permutations 12 : : :n on 8. = 9. =
n
f1 2 : : : ng with k ascents. nm
k=0 m+1
k ; n ; 1 k=0 k n; k  n
k 2nd order Eulerian numbers. 10. k = (;1)k k 11. n1 = nn = 1
Cn Catlan Numbers: Binary n n n ; 1 n ; 1
trees with n + 1 vertices. 12. 2 = 2 ; 1 n ;1
13. k = k k + k ; 1

n = (n ; 1)! 
n = (n ; 1)!H 
n =1 n  n
14. 1 15. 2  n;1 16. n 17. k  k

n = (n ; 1) n ; 1 + n ; 1
    Xn 
18. k k k;1 19. n ;n 1 = n ;n 1 = n2 20. n = n! 21. C = 1 2n
n n+1 n
n  n  n  n   n k=0 k  n ; 1  n ; 1
22. = = 1 23. = 24. = (k + 1) + (n ; k)
 00  n n ; 1 k  n; 1 ; k
n
k  n k kn ;+ 11
25. 1 if k = 0, 26. 1 = 2n ; n ; 1 27. 2 = 3n ; (n + 1)2n + 2
k = 0  otherwise n X
X n n x+k m n + 1 n X n  n  k 
28. xn = k n 29. m = k (m + 1 ; k)n(;1)k 30. m! m = k n;m
 n k=0X n  n n ; k
k=0  n   nk=0

31. n;k;m k! 32. 0 = 1 33. n = 0 for n 6= 0
m = k=0 k m (;1)
 n   n ; 1   n ; 1  X n  n  (2n)n
34. k = (k + 1) k + (2n ; 1 ; k)
k;1 35. k = 2n
 x X n  n x + n ; 1 ; k  n + 1 X n k X n k
k =0

36. x ; n = k=0 k 2n 37. m + 1 = k m = m (m + 1)n;k


k k=0
Theoretical Computer Science Cheat Sheet
Identities Cont. Trees
 X   X
n 
k nn;k = n! X n 1 k  X n  n x + k Every tree with n
38. mn ++ 11 = n k =
k m k=0 m 39. x ;x n = vertices has n ; 1
 n X k n k=0 k! m  k=0 k  2n
k+1 n X n+1 k edges.
40. m = k m + 1 (;1)n;k 41. m = k + 1 m (;1)m;k Kraft inequal-
 m + n +k1 Xm n + k m + n + 1
k
X m n + k
ity: If the depths
42. = k k 43. = k(n + k) of the leaves of
m m k a binary tree are
 n  X  n +k=0
1
k  n  X n + 1  k k=0 d1 :n: : dn:
44. m = (;1) m; k 45. (n ; m)! m = (;1)m;k for n  m, X ;di
k + 1 m k + 1 m 2 1
 n k X m ; nm + n m + k  n
k
X m ; nm + n m + k i=1
46. n ; m = 47. n ; m =
 n ` +kmm +Xk  kn 
+k
n
k

;k n
 n
m + k n + k k
k` + m X k  n ; k n and equality holds
only if every in-
48. ` + m ` = ` m k 49. ` + m ` = ` m k : ternal node has 2
k k sons.
Recurrences
Master method: ;
1 T(n) ; 3T(n=2) = n
 Generating functions:
T (n) = aT(n=b) + f(n) a  1 b > 1 ;  1. Multiply both sides of the equa-
If 9 > 0 such that f(n) = O(nlogb a; ) 3 T(n=2) ; 3T (n=4) = n=2 tion by xi .
then .. .. .. 2. Sum both sides over all i for
T (n) = (nlogb a ): . . . which the equation is valid.
3 log2 n ; 1
;T(2) ; 3T(1) = 2 3. Choose a generatingPfunction
If f(n) = (nlogb a ) then ;
3log2 n T(1) ; 0 = 1
 G(x). Usually G(x) = 1 i
i=0 x .
T(n) = (nlogb a log2 n): 3. Rewrite the equation in terms of
If 9 > 0 such that f(n) = (nlogb a+ ), Summing the left side we get T(n). Sum- the generating function G(x).
and 9c < 1 such that af(n=b)  cf(n) ming the right side we get 4. Solve for G(x).
for large n, then X2 n n i
log 5. The coecient of xi in G(x) is gi .
T(n) = (f(n)): i3 : Example:
i=0 2 gi+1 = 2gi + 1 g0 = 0:
Substitution (example): Consider the Let c = 23 andm = log2 n. Then we have Multiply
following recurrence Xm c m+1 ; 1  X andi sum: X X
i
Ti+1 = 22  Ti2 T1 = 2: n ci = n c ; 1 gi+1 x = 2gi xi + xi:
i=0 i0 i0 i0
Note that Ti is always a power of two. = 2n(c  c log2 n
; 1)
P
We choose G(x) = i0 xi. Rewrite
Let ti = log2 Ti . Then we have k logc n in terms of G(x):
ti+1 = 2i + 2ti t1 = 1: = 2n(c  c ; 1)
G(x) ; g0 X i
Let ui = ti =2i. Dividing both sides of = 2nk+1 ; 2n  2n1:58496 ; 2n x = 2G(x) + x:
i0
the previous equation by 2i+1 we get where k = (log2 32 );1 . Full history recur-
ti+1 = 2i + ti : rences can often be changed to limited his- Simplify:
2i+1 2i+1 2i tory ones (example): Consider the follow- G(x) = 2G(x) + 1 :
Substituting we nd ing recurrence x 1;x
ui+1 = 12 + ui u1 = 12 X
i;1 Solve for G(x):
x
Ti = 1 + Tj T0 = 1: G(x) = (1 ; x)(1 :
which is simply ui = i=2. So we i;nd1 j =0 ; 2x)
that Ti has the closed form Ti = 2i2 . Note that Expand this using partial fractions:
Summing factors (example): Consider Xi 
the following recurrence Ti+1 = 1 + Tj : G(x) = x 1 ;2 2x ; 1 ;1 x
Ti = 3Tn=2 + n T1 = n: j =0 0 1
X X
Rewrite so that all terms involving T Subtracting we nd = x @2 2i xi ; xi A
are on the left side Xi X
i;1
Ti ; 3Tn=2 = n: Ti+1 ; Ti = 1 + Tj ; 1 ; Tj X ii+10 i0
i+1
j =0 j =0 = (2 ; 1)x :
Now expand the recurrence, and choose = Ti : i0
a factor which makes the left side \tele-
scope" And so Ti+1 = 2Ti = 2i+1. So gi = 2i ; 1.
Theoretical Computer Science Cheat Sheet
p p
  3:14159, e  2:71828,   0:57721, = 1+2 5  1:61803, ^ = 1;2 5  ;:61803
i 2i pi General Probability
1 2 2 Bernoulli Numbers (Bi = 0, odd i 6= 1): Continuous distributions:Z If
b
2 4 3 B0 = 1, B1 = ; 2 , B2 = 6 , B4 = ; 30 ,
1 1 1
Pra < X < b] = p(x) dx
3 8 5 B6 = 421 , B8 = ; 301 , B10 = 665 . a
4 16 7 Change of base, quadratic formula: then p is the probability density function of
p X. If
5 32 11 logb x = log blog a x ;b b2 ; 4ac
: PrX < a] = P(a)
6 64 13 a 2a then P is the distribution function of X. If
7 128 17 Euler's number e: P and p both existZthen
8 256 19 e = 1 + 21 + 16 + 241 + 120 1 +  a
 x n x P (a) = p(x) dx:
9 512 23 lim 1 + = e : ;1
10 1,024 29 ;1 +n!1  n;  Expectation: If XX is discrete
1 n < e < 1 + 1 n+1 :
11 2,048 31 n n   Eg(X)] = g(x) PrX = x]:
12 4,096 37
;  n e
1 + n = e ; 2n + 24n2 ; O n3 :
1 11e 1 x
If X continuous
Z1 then Z1
13 8,192 41 Harmonic numbers:
14 16,384 43 Eg(X)] = g(x)p(x) dx = g(x) dP (x):
1, 23 , 116 , 25
12 , 60 , 20 , 140 , 280 , 2520 : : :
137 49 363 761 7129 ;1 ;1
15 32,768 47 Variance, standard deviation:
16 65,536 53 lnn < Hn < ln n + 1 VARX] = EX 2] ; EX]2
17 131,072 59 1 p
Hn = ln n +  + O n : = VARX]:
18 262,144 61 Basics:
19 524,288 67 Factorial, Stirling's approximation: PrX _ Y ] = PrX] + PrY ] ; PrX ^ Y ]
20 1,048,576 71 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, : : : PrX ^ Y ] = PrX]  PrY ]
21 2,097,152 73 p  n n  1  i X and Y are independent.
n! = 2n 1 +  :
22 4,194,304 79 e n PrX jY ] = PrX ^Y]
PrB]
23 8,388,608 83 Ackermann's 8 jfunction and inverse: EX  Y ] = EX]  EY ]
24 16,777,216 89 <2 i=1
25 33,554,432 97 a(i j) = : a(i ; 1 2) j=1 i X and Y are independent.
26 67,108,864 101 a(i ; 1 a(i j ; 1)) i j  2 EX + Y ] = EX] + EY ]
27 134,217,728 103
(i) = minfj j a(j j)  ig: EcX] = c EX]:
28 268,435,456 107 Binomial distribution: Bayes' theorem:
n
29 536,870,912 109 PrX = k] = k pk qn;k q = 1;p PrAijB] = PnPrB jAi] PrAi ]
PrA :
30 1,073,741,824 113 j =1 j ] PrB jAj ]
Xn n Inclusion-exclusion:
31 2,147,483,648 127 E X] = k = 1k p k qn;k = np: h _n i X n
32 4,294,967,296 131 k Pr Xi = PrXi ] +
Pascal's Triangle Poisson distribution: i=1 i=1
; k
1 PrX = k] = k! e
EX] = : X k+1 X h ^k i
n
(;1) Pr Xij :
11 Normal (Gaussian) distribution: k=1 ii <<ik j =1
121 p(x) = p 1 e;(x;)2 =22 EX] = : Moment inequalities:
 
1331 2 Pr jX j  EX]  1
The \coupon collector": We are given a h
14641 random coupon each day, and there are n Pr X X]
   i  1 :
1 5 10 10 5 1 dierent types of coupons. The distribu-
; E 2
1 6 15 20 15 6 1 tion of coupons is uniform. The expected Geometric distribution:
1 7 21 35 35 21 7 1 number of days to pass before we to col- PrX = k] = pk;1q q = 1;p
1 8 28 56 70 56 28 8 1 lect all n types is X1
nH n : E X] = kpqk;1 = p1 :
1 9 36 84 126 126 84 36 9 1 k=1
1 10 45 120 210 252 210 120 45 10 1
Theoretical Computer Science Cheat Sheet
Trigonometry Matrices More Trig.
Multiplication: C
X
n
(0,1)
C = AB cij = aik bkj : b h a
b (cos  sin ) k=1
A C  Determinants: det A = 0 i A is non-singular.
A c B
(-1,0) (1,0)
det A  B = det A  det B
c a XY
n Law of cosines:
B (0,-1)
det A = sign()ai(i) : c2 = a2 +b2;2ab cos C:
Pythagorean theorem:  i=1
2 2 and 3 3 determinant: Area:
C 2 = A2 + B 2 :  a b 
De nitions:  c d  = ad ; bc A = 21 hc
sin a = A=C cos a = B=C  a b c        = 12 ab sin C
csc a = C=A sec a = C=B  d e f  = g  b c  ; h  a c  + i  a b 
 g h i   e f   d f   d e = c sin A sin B :
2
sin a = A cot a = cos a = B :
tan a = cos 2 sinC
a B sin a A aei + bfg + cdh Heron's formula:
Area, radius of inscribed circle: = ; ceg ; fha ; ibd: p
1 AB AB : Permanents: A = s  sa  sb  sc
2 A+B +C XY
n s = 12 (a + b + c)
Identities: perm A = ai(i) : sa = s ; a
 i=1
sin x = csc1 x cos x = sec1 x Hyperbolic Functions sb = s ; b
sc = s ; c:
tan x = cot1 x sin2 x + cos2 x = 1 De nitions:
x ;x x ;x
sinh x = e ;2 e cosh x = e +2e More identities:
r
1 + tan2 x = sec2 x 1 + cot x = csc x sin 2 = 1 ; 2cos x
2 2
x e;x x
; 
sin x = cos 2 ; x sin x = sin( ; x) tanh x = eex ;
+ e;x
1
csch x = sinh x r
;  1
sech x = cosh x 1 :
coth x = tanh cos x = 1 + 2cos x
cos x = ; cos( ; x) tan x = cot  ; x
2 x 2
r 1 ; cos x
cot x = ; cot( ; x) csc x = cot x2 ; cot x Identities: x
tan 2 = 1 + cos x
cosh2 x ; sinh2 x = 1 tanh2 x + sech2 x = 1
sin(x y) = sin x cos y cos x siny = 1 ;sincosx x
coth2 x ; csch2 x = 1 sinh(;x) = ; sinh x
cos(x y) = cos x cos y sin x sin y
cosh(;x) = cosh x tanh(;x) = ; tanh x = 1 +sincosx x
tan(x y) = 1tan x tan y r 1 + cos x
tan x tany sinh(x + y) = sinh x cosh y + cosh x sinh y x
cot 2 = 1 ; cos x
cot(x y) = cotxxcot
cot y 1
cot y
cosh(x + y) = cosh x cosh y + sinh x sinh y = 1 +sincosx x
sin 2x = 2 sin x cos x sin 2x = 2 tanx2 sinh 2x = 2 sinh x cosh x
1 + tan x = 1 ;sincos
x
x
cos 2x = cos x ; sin x
2 2
cos 2x = 2 cos2 x ; 1 cosh 2x = cosh2 x + sinh2 x
e ix ; e;ix
cos 2x = 1 ; 2 sin2 x cos 2x = 11 ; tan2 x cosh x + sinh x = ex cosh x ; sinh x = e;x sin x = 2i
+ tan2 x (cosh x + sinh x)n = cosh nx + sinh nx n 2 Z e ix + e;ix
2 tanx cot2 x ; 1 cos x = 2
tan 2x = 1 ; tan x
2 cot 2x = 2 cot x 2 sinh2 x2 = cosh x ; 1 2 cosh2 x2 = cosh x + 1: eix ; e;ix
tan x = ;i eix + e;ix
sin(x + y) sin(x ; y) = sin x ; sin y
2 2
 sin cos  tan  : : : in mathematics 2ix
cos(x + y) cos(x ; y) = cos2 x ; sin2 y: you don't under- = ;i ee2ix ;+1
1
0 0 p1 p0 stand things, you
Euler's equation: 
6
1
p22
3
p22 3
3
just get used to sin x = sinhi ix
eix = cos x + i sin x ei = ;1:  1 them.
4 p23 2
p { J. von Neumann cos x = cosh ix
c 1994 by Steve Seiden  1
3
[email protected] 3

2
1
2
0 1 tan x = tanhi ix :
http://www.ics.uci.edu/~sseiden 2
Theoretical Computer Science Cheat Sheet
Number Theory Graph Theory
The Chinese remainder theorem: There ex- De nitions: Notation:
ists a number C such that: Loop An edge connecting a ver- E(G) Edge set
tex to itself. V (G) Vertex set
C  r1 mod m1 Directed Each edge has a direction. c(G) Number of components
.. .. .. Simple Graph with no loops or GS] Induced subgraph
. . . deg(v) Degree of v
C  rn mod mn multi-edges.
Walk A sequence v0e1 v1 : : :e` v` . (G) Maximum degree
if mi and mj are relatively prime for i 6= j. Trail A walk with distinct edges. (G) Minimum degree
Euler's function: (x) is the number of Path A trail with distinct (G) Chromatic number
positive integersQnless than x relatively vertices.  E (G) Edge chromatic number
G c Complement graph
prime to x. If i=1 pei i is the prime fac- Connected A graph where there exists
torization of x then a path between any two K n Complete graph
Yn vertices. Kn1 n2 Complete bipartite graph
(x) = pei i ;1(pi ; 1): Component A maximal connected r(k `) Ramsey number
i=1 subgraph. Geometry
Euler's theorem: If a and b are relatively Tree A connected acyclic graph.
prime then Free tree A tree with no root. Projective coordinates: triples
1  a (b) mod b: DAG Directed acyclic graph. (x y z), not all x, y and z zero.
Eulerian Graph with a trail visiting (x y z) = (cx cy cz) 8c 6= 0:
Fermat's theorem: each edge exactly once. Cartesian Projective
1  ap;1 mod p:
Hamiltonian Graph with a path visiting (x y) (x y 1)
The Euclidean algorithm: if a > b are in- each vertex exactly once. y = mx + b (m ;1 b)
tegers then Cut A set of edges whose re- x=c (1 0 ;c)
gcd(a b) = gcd(a mod b b): moval increases the num- Distance formula, Lp and L1
Q
If ni=1 pei i is the prime factorization of x ber of components. metric:
Cut-set A minimal cut. p
then (x ; x )2 + (x ; x )2
X Y n ei +1 Cut edge A size 1 cut. jx ;1 x jp0+ jx ;1x jp01=p
S(x) = d = pip ;;1 1 : k-Connected A graph connected with 1 0 1 0
djx i=1 i
the removal of any k ; 1 lim
 jx1 ; x0 j + jx1 ; x0jp
p 1=p:
Perfect Numbers: x is an even perfect num- vertices. p !1
ber i x = 2n;1(2n ; 1) and 2n ; 1 is prime. k-Tough 8S  V S 6=  we have Area of triangle (x0 y0), (x1 y1 )
Wilson's theorem: n is a prime i k  c(G ; S)  jS j. and (x2 y2): 
(n ; 1)!  ;1 mod n: k-Regular A graph where all vertices 
 x 1 ; x0 y1 ; y0 
2 abs  x2 ; x0 y2 ; y0  :
1
have degree k.
Mobius 8inversion: k-Factor A k-regular spanning Angle formed by three points:
< 10
> if i = 1.
subgraph.
(i) = > (;1)r ifif ii isis not
the
square-free.
product of Matching A set of edges, no two of (x2 y2 )
: r distinct primes. which are adjacent.
Clique A set of vertices, all of `2
If X which are adjacent. 
G(a) = F(d) Ind. set A set of vertices, none of (0 0) `1 (x1 y1 )
dja
which are adjacent.
then X   Vertex cover A set of vertices which cos  = (x1 y1`) `(x2 y2) :
F(a) = (d)G ad : cover all edges. 1 2
Line through two points (x0 y0 )
dja Planar graph A graph which can be em- and (x1 y1):
Prime numbers: beded in the plane.  x y 1 
pn = n ln n + n lnln n ; n + n lnlnlnnn Plane graph An embedding of a planar
graph.
 x0 y0 1  = 0:
n X  x1 y1 1 
+ O ln n deg(v) = 2m: Area of circle, volume of sphere:
v2V A = r2 V = 43 r3:
(n) = lnnn + (lnnn)2 + (lnn)
2!n
3 If G is planar then n ; m + f = 2, so If I have seen farther than others,
 n  f  2n ; 4 m  3n ; 6: it is because I have stood on the
+ O (ln n)4 : Any planar graph has a vertex with de- shoulders of giants.
gree  5. { Issac Newton
Theoretical Computer Science Cheat Sheet
 Calculus
Wallis' identity: Derivatives:
 = 2  21  23  43  45  65  67    1. d(cu) du 2. d(udx+ v) = dx
du + dv 3. d(uv) dv + v du
dx = c dx ; dx
 ;  dx = u dx dx
Brouncker's continued fraction expansion: n du
d(u=v) v dx ; u dx dv cu
 =1+ 12 4. d(u ) n;1 du
dx = nu dx 5. dx = v2 6. d(edx ) = cecu du
dx
4
2 + 2+ 3252 u
72
2+ 2+  7. d(cdx ) = (ln c)cu du
dx 8. d(ln u) 1 du
dx = u dx
Gregrory's series:
9. d(sin u) = cos u du d(cos u) = ; sin u du
 = 1; 1 + 1 ; 1 + 1 ; 
4 3 5 7 9
dx dx 10. dx dx
Newton's series:
d(tan u)
11. dx = sec2 u dx du 12. dx = csc 2 u du
d(cot u)
=1+ 1 + 13 +  dx
6 2 2  3  23 2  4  5  25
Sharp's series: 13. d(sec u)
dx = tan u sec u dx
du 14. d(csc u)
dx = ; cot u csc u dx
du
 
 = p1 1 ; 1 + 1 ; 1 +    15. d(arcsin u)
dx = p1 ; u2 dx
1 du 16. d(arccos
dx
u) = p ;1 du
1 ; u2 dx
6
3 31  3 32  5 33  7
Euler's series: 17. d(arctandx
u) = 1 du
1 ; u dx
2
18. d(arccot u) = ;1 du
dx 1 ; u2 dx
2 = 112 + 212 + 312 + 412 + 512 +   
6
 = 12 + 12 + 12 + 12 + 12 +   
2 19. d(arcsec
dx
u) = p 1 du
u 1 ; u2 dx
20. d(arccsc
dx
u) = p;1 du
u 1 ; u2 dx
8 1 3 5 7 9
2 = 12 ; 12 + 12 ; 12 + 12 ;   
12 1 2 3 4 5 21. d(sinh u) du
dx = cosh u dx 22. d(cosh u) du
dx = sinh u dx
Partial Fractions
Let N(x) and D(x) be polynomial func- 23. d(tanh u) 2 du
dx = sech u dx 24. d(coth u) 2 du
dx = ; csch u dx
tions of x. We can break down
N(x)=D(x) using partial fraction expan- 25. d(sech u) du
dx = ; sech u tanh u dx 26. d(csch u) du
dx = ; csch u coth u dx
sion. First, if the degree of N is greater
than or equal to the degree of D, divide 27. d(arcsinh
dx
u) = p 1 du 28. d(arccosh u) = p 1 du
N by D, obtaining 1 + u dx 2 dx u ; 1 dx
2
N(x) = Q(x) + N 0(x) d(arctanh u) 1 du d(arccoth u) 1 du
D(x) D(x) 29. dx = 1 ; u2 dx 30. dx = u ; 1 dx
2

where the degree of N 0 is less than that of 31. d(arcsech u) = p;1 du 32. d(arccsch u) = p;1 du :
D. Second, factor D(x). Use the follow- dx u 1 ; u2 dx dx juj 1 + u2 dx
ing rules: For a non-repeated factor: Integrals:
N(x) = A + N 0 (x) Z Z Z Z Z
(x ; a)D(x) x ; a D(x) 1. cu dx = c u dx 2. (u + v) dx = u dx + v dx
where  Z 1 n+1 Z 1 Z
A = N(x)
D(x) x=a :
3. xn dx = n + 1x n 6= ;1 4. x dx = ln x 5. ex dx = ex
Z dx Z dv Z du
For a repeated factor: 6. 7.
N(x) mX;1 Ak + N 0 (x) 1 + x2 = arctan x u dx dx = uv ; v dx dx
= Z Z
m
(x ; a) D(x) (x ; a)m;k D(x)
k=0 8. sin x dx = ; cos x 9. cos x dx = sinx
where   Z Z
dk N(x)
Ak = k!1 dx : 10. tan x dx = ; ln j cos xj 11. cot x dx = ln j cos xj
k D(x)
x=a Z Z
The reasonable man adapts himself to the 12. sec x dx = ln j sec x + tan xj 13. csc x dx = ln j csc x + cot xj
world! the unreasonable persists in trying Z p
to adapt the world to himself. Therefore 14. arcsin xa dx = arcsin xa + a2 ; x2 a>0
all progress depends on the unreasonable.
{ George Bernard Shaw
Theoretical Computer Science Cheat Sheet
Z Calculus Cont. Z
p
15. arccos ax dx = arccos xa ; a2 ;x 2 a>0 16. arctan xa dx = x arctan ax ; a2 ln(a2 + x2) a > 0
Z ;  Z ; 
17. sin2 (ax)dx = 21a ax ; sin(ax) cos(ax) 18. cos2(ax)dx = 21a ax + sin(ax) cos(ax)
Z Z
19. sec 2 x dx = tan x 20. csc2 x dx = ; cot x
Z n;1 1 Z sinn;2 x dx Z n;1 x sinx n ; 1 Z
21. sinn x dx = ; sin nx cos x + n ; n 22. cos n x dx = cos
n + n cosn;2 x dx
Z tan n;1 x Z Z cot n;1 x Z
23. n n
tan x dx = n ; 1 ; tan x dx n 6= 1; 2 24. cot x dx = ; n ; 1 ; cotn;2 x dx n 6= 1
n
Z n;1 x n ; 2 Z
25. sec n x dx = tan xnsec
;1
+ n ; 1 sec n;2 x dx n 6= 1
Z n;1 x n ; 2 Z Z Z
26. csc n x dx = ; cot xncsc
;1
+ n;1 csc n;2 x dx n 6= 1 27. sinh x dx = cosh x 28. cosh x dx = sinh x
Z Z Z Z  
29. tanh x dx = ln j cosh xj 30. coth x dx = ln j sinh xj 31. sech x dx = arctan sinh x 32. csch x dx = ln tanh x2 
Z Z Z
33. sinh x dx = sinh(2x) ; x
2 1
4
1
2 34. cosh x dx = sinh(2x) + x
2 1
4
1
2 35. sech 2 x dx = tanh x
Z p Z
36. arcsinh ax dx = x arcsinh ax ; x +a2 2 a>0 37. arctanh xa dx = x arctanh xa + a2 ln ja2 ; x2 j
8 p
Z < x arccosh xa ; x2 + a2 if arccosh xa > 0 and a > 0,
38. arccosh ax dx = : p
x arccosh xa + x2 + a2 if arccosh xa < 0 and a > 0,
Z dx  p 2 2
39. p
a2 + x2
= ln x + a + x a>0
Z dx Zp p
40. x
a2 + x2 = a arctan a a > 0
1
41. a2 ; x2 dx = x2 a2 ; x2 + a22 arcsin ax a>0
Z p
42. (a2 ; x2)3=2dx = x8 (5a2 ; 2x2) a2 ; x2 + 3a84 arcsin xa a > 0
Z dx Z dx

1 ln  a + x 
 Z dx x
43. p = arcsin ax a>0 44. =
a ; x 2a  a ; x  45. (a ; x ) = = p 2
Z pa ; x a a ; x2
2 2 2 2 2 2 3 2 2
p  p  Z  p 2 2
46. a2 x2 dx = x2 a2 x2 a2 ln x + a2 x2 
2
47. px2dx; a2 = ln x + x ; a  a > 0
Z   Z p + bx)3=2
48. ax2dx+ bx = a1 ln  a +x bx  49. x a + bxdx = 2(3bx ; 2a)(a 15b2
Z pa + bx p Z 1 Z x 1

 p
a + bx
p 
; a 
50. dx = 2 a + bx + a p dx 
51. pa + bx dx = p ln  pa + bx + pa  a > 0
Z pa2x; x2 p2 2
x a +pbx 
 a + a2 ; x2  Z p2
52. x dx = a ; x ; a ln  x  53. x a2 ; x2 dx = ; 13 (a2 ; x2)3=2
 p 2 2 
Z p p Z dx
54. x2 a2 ; x2 dx = x8 (2x2 ; a2) a2 ; x2 + a8 arcsin xa a > 0 4
55. p 2 2 = ; a1 ln  a + ax ; x 
Z x dx Z x2 dx a ;x
p2 2 p
56. pa2 ; x2 = ; a ; x 57. pa2 ; x2 = ; x2 a2 ; x2 + a2 arcsin ax a > 0 2

Z pa2 + x2 p2 2  p 2 2  Z px2 ; a2 p2 2
58. dx = a + x ; a ln 
 a + a + x 
 59. dx = x ; a ; a arccos jaxj a > 0
x  x  x
 
Z p Z
60. x x2 a2 dx = 13 (x2 a2)3=2 61. xpxdx 2 + a2
= 1 ln  x
a  a + a2 + x2 
p 
Theoretical Computer Science Cheat Sheet
Calculus Cont. Finite Calculus
Z dx = 1 arccos a a > 0 Z p
Dierence, shift operators:
63. 2 p dx2 2 = xa2 x a
2 2
62. p a jx j f(x) = f(x + 1) ; f(x)
Z x x ;a
2 2
Z px2x ax2 a (x2 + a2)3=2
x dx p2 2 E f(x) = f(x + 1):
64. p 2 = x a 65. x4  dx = 3a2x3 Fundamental Theorem:
x a2 8  X
 2ax + b ; pb2 ; 4ac  if b2 > 4ac,
p
Z >
> 1 f(x) = F (x) , f(x)x = F (x) + C:
dx < p2 ln
b ; 4ac  2ax + b + b2 ; 4ac 
66. =
ax + bx + c >
X
b X
b;1
2
: p 2 2 arctan p2ax + b 2 f(x)x = f(i):
if b2 < 4ac, a i=a
4ac ; b 4ac ; b Dierences:
8 1  p p 
Z >
< p ln 2ax + b + 2 a ax2 + bx + c if a > 0, (cu) = c u (u + v) = u + v
dx a (uv) = u v + E v u
67. p 2 =
ax + bx + c > : p1;a arcsin p;b2ax ;b
2 ; 4ac
if a < 0, (xn) = nxn;1
Z p 2 p 2Z
(Hx ) = x;1 (2x ) = 2x
68. ax + bx + c dx = 2ax4a+ b ax2 + bx + c + 4ax8a; b p 2 dx (cx ) = (c ; 1)cx
; x  ;x
ax + bx + c m = m;1 :
Sums:
Z x dx ax
p
2 + bx + c b Z dx P cu x = c P u x
69. p 2
ax + bx + c
= a ;
2a p
ax + bx + c
2 P(u + v) x = P u x + P v x
8 ;1  2pcpax2 + bx + c + bx + 2c  P u v x = uv ; P v u x
>
Z dx < pc ln 
> x
 if c > 0,
 P xn x = xn+1
E
P x;1 x = H
70. p => m+1 x
x ax + bx + c > 1
: p;c arcsin jxjpbxb2+;2c4ac P; x  x = ; x :
2
if c < 0, P cx x = cx
c;1 m m+1
Z p Falling Factorial Powers:
71. x3 x2 + a2 dx = ( 13 x2 ; 152 a2 )(x2 + a2)3=2 xn = x(x ; 1)    (x ; m + 1) n > 0
Z Z x0 = 1
72. xn sin(ax) dx = ; a1 xn cos(ax) + na xn;1 cos(ax) dx
Z Z xn = (x + 1)  1 (x + jnj) n < 0
73. xn cos(ax) dx = n n n;1
a x sin(ax) ; a x sin(ax) dx
1
xn+m = xm (x ; m)n :
Z xn eax ; n Z xn;1eax dx Rising Factorial Powers:
74. xneax dx = a a xn = x(x + 1)    (x + m ; 1) n > 0
Z  
75. xn ln(ax) dx = xn+1 ln(ax) ;
1
n + 1 (n + 1)2
x0 = 1
Z n+1 Z xn = (x ; 1)  1 (x ; jnj) n < 0
76. xn(ln ax)m dx = nx + 1 (ln ax)m ; n m n m;1
+ 1 x (ln ax) dx: xn+m = xm (x + m)n :
Conversion:
x1 = x1 = x1 xn = (;1)n (;x)n = (x ; m + 1)n
x2 = x2 + x1 = x2 ; x1 = 1=(x + 1);n
x3 = x3 + 3x2 + x1 = x3 ; 3x2 + x1 xn = (;1)n (;x)n = (x + m ; 1)n
x4 = x + 6x3 + 7x2 + x1
4 = x ; 6x3 + 7x2 ; x1
4 = 1=(x ; 1);n
Xn n n 
x5 = x5 + 15x4 + 25x3 + 10x2 + x1 = x5 ; 15x4 + 25x3 ; 10x2 + x1
xn = x k = X n (;1)n;k xk
x1 = x1 x1 = x1 k=1 k k=1 k
X n
n 
x =
2 x + x1
2 x =
2 x ; x1
2
xn = (;1)n;k xk
x3 = x3 + 3x2 + 2x1 x3 = x3 ; 3x2 + 2x1 k=1 k
x4 = x4 + 6x3 + 11x2 + 6x1 x4 = x4 ; 6x3 + 11x2 ; 6x1 Xn n
n
x = xk :
x5 = x5 + 10x4 + 35x3 + 50x2 + 24x1 x5 = x5 ; 10x4 + 35x3 ; 50x2 + 24x1 k=1 k
Theoretical Computer Science Cheat Sheet
Series
Taylor's series: Ordinary power series:
X1 i X
1
f(x) = f(a) + (x ; a)f 0 (a) + (x ;2 a) f 00 (a) +    = (x ;i! a) f (i) (a):
2
A(x) = aixi :
i=0 i=0
Expansions:
1 X
1 Exponential power series:
= 1 + x + x2 + x3 + x4 +    = xi X1 i
1;x i=0 A(x) = ai xi! :
1 X
1 i=0
1 ; cx = 1 + cx + c2x2 + c3 x3 +    = ci xi Dirichlet power series:
i=0 X1
1 X
1
A(x) = iaxi :
1 ; xn = 1 + xn + x2n + x3n +    = xni
i=0 i=1
x X
1 Binomial theorem: 
(1 ; x)2 = x + 2x2 + 3x3 + 4x4 +    = ixi X n n
n;k k
 1  i=0 (x + y)n = k x y:
dn X
1 k=0
xk dx n 1;x = x + 2n x2 + 3nx3 + 4n x4 +    = n i xi Dierence of like powers:
i=0 nX
;1
X
1 xi
xn ; yn = (x ; y) xn;1;kyk :
ex = 1+x+ x + x +
1 2
2
1 3
6 = i!
i=0 k=0
X
1 xi For ordinary power series:
ln(1 + x) = x ; 12 x2 + 31 x3 ; 14 x4 ;    = (;1)i+1 i X
1
i=1
A(x) + B(x) = (
ai + bi )xi
X1 i
ln 1 ;1 x = x + 12 x2 + 31 x3 + 14 x4 +    = xi i=0
X
1
i=1 xk A(x) = ai;k xi
X1 2i+1
sin x = x ; 3!1 x3 + 5!1 x5 ; 7!1 x7 +    = (;1)i (2ix + 1)! P i=0
i=0 A(x) ; k ;1
ax X
i=0 i
i 1
X1 x2i xk = ai;k xi
cos x = 1; x + x
1 2 1 4
; 1 6
x + = (;1)i (2i)! i=0
2! 4! 6!
i1
=0 X
1
X x2i+1 A(cx) = ci aixi
tan;1 x = x ; 13 x3 + 51 x5 ; 17 x7 +    = (;1)i (2i i=0
i=0   + 1) X
1
X1 n A0 (x) = (i + 1)ai+1 xi
(1 + x)n = 1 + nx + n(n2;1) x2 +    = i xi i=0
i=0 
1 ; x2 +    X1 i + n X
1
= 1 + (n + 1)x + n+2 = xi xA0 (x) = iai xi
(1 ; x)n+1 2 i i=1
x
i=0
X1 i Z X
1 a
ex ; 1 = 1 ; 12 x + 121 x2 ; 720
1 x4 +    = Bi!i x A(x) dx = i;1
i x
i
1 1 2i
i=0 i=1
1 (1 ; p1 ; 4x) X A(x) + A(;x) = X1
2x = 1 + x + 2x2 + 5x3 +    = i + 1 i xi a2ix2i
i=0   2 i=0
1 X1 2i
A(x) ; A(;x) 1 X
p = 1 + x + 2x2 + 6x3 +    = i xi = a2i+1x : 2i+1
1 ; 4x 2
1
 1 ; p1 ; 4x n ;4+nx2 +   
i=0 
X1 2i + n i=0
P
p
2x = 1 + (2 + n)x + = i xi Summation: If bi = ij =0 ai then
1 ; 4x 2
i=0
1 1 X
1 B(x) = 1 ;1 x A(x):
1 ; x ln 1 ; x = x + 32 x2 + 116 x3 + 25
12 x +    =
4 Hi xi
Convolution: 0 1
1 ln 1 2
i=1
X
1 H xi
i;1 X
1 X i
2 1;x = 12 x2 + 34 x3 + 11
24 x +   
4 = i A(x)B(x) = @ aj bi;j A xi:
i=2
x X
1 i=0 j =0
1 ; x ; x2 = x + x + 2x + 3x +   
2 3 4 = Fi xi
i=0 God made the natural numbers!
Fn x X
1 all the rest is the work of man.
1 ; (Fn;1 + Fn+1)x ; (;1)n x2 = Fnx + F2nx + F3nx +    =
2 3 Fnixi : { Leopold Kronecker
i=0
Theoretical Computer Science Cheat Sheet
Series Escher's Knot
Expansions:
1 1 X
1 n + i  1 ;n X1 i
i xi
(1 ; x)n+1 ln 1 ; x = (Hn+i ; Hn) i x
i=0  x = n
i=0 
X1 n X1 i n!xi
xn = i xi (ex ; 1)n = n i!
 1 n i=0 
X1 i n!xi i=0
X
1 (;4)i B x2i
2i
ln 1 ; x = n i! x cot x = (2i)!
i=0 i=0
X
1 2i 2i 2i;1 X
1 1
tanx = (;1)i;1 2 (2 ;(2i)!
1)B2i x (x) = ix
i=1 i=1
1 X1 X1
(x) = (i) x
(x ; 1) = (i)x
i=1 i (x) i=1 i
Y
(x) = 1 ;1p;x Stieltjes Integration
p
X
1 d(i) If G is continuous in the interval a b] and F is nondecreasing then
 (x) =
P Zb
i where d(n) = djn 1
2
i=1 x G(x) dF (x)
a
X1 P d exists. If a  b  c then
(x)(x ; 1) = S(i) i where S(n) = djn Zc Zb Zc
i=1 x G(x) dF(x) = G(x) dF(x) + G(x) dF (x):
2n;1jB j
= 2 (2n)! 2n 2n a a b
(2n)  n2N If the integrals involved exist
Z b;  Zb Zb
x X1 i 2)B2ix2i
= (;1)i;1 (4 ;(2i)! a
G(x) + H(x) dF(x) = G(x) dF(x) + H(x) dF(x)
a
sin x i=0 Zb ;  Zb Za b
 1 ; p1 ; 4x n X1 G(x) d F (x) + H(x) = G(x) dF(x) + G(x) dH(x)
2x = n(2i + n ; 1)! xi
i!(n + i)!
a
Zb Zb a
Z ab
i=0
c  G(x) dF(x) =
;
G(x) d c  F(x) = c
 G(x) dF (x)
X1 2i=2 sin i
a a a
ex sin x = i!
4 xi
Zb Z b
s i=1 G(x) dF(x) = G(b)F (b) ; G(a)F (a) ; F(x) dG(x):
1; 1;x
p X
1 (4i)! a a
If the integrals involved exist, and F possesses a derivative F 0 at every
x = i p xi
i=0 16 2(2i)!(2i + 1)! point in a b] then
 arcsin x 2 X 1 4i i!2 Zb Zb
x = (i + 1)(2i + 1)! x2i: G(x) dF (x) = G(x)F 0(x) dx:
i=0 a a
Crammer's Rule 0 47 18 76 29 93 85 34 61 52
Fibonacci Numbers
If we have equations:
a11x1 + a12x2 +    + a1nxn = b1
86 11 57 28 70 39 94 45 2 63
1 1 2 3 5 8 13 21 34 55 89 : : :
95 80 22 67 38 71 49 56 13 4
a21x1 + a22x2 +    + a2nxn = b2 59 96 81 33 7 48 72 60 24 15
De nitions:
.. .. .. 73 69 90 82 44 17 58 1 35 26 Fi = Fi;1+Fi;2 F0 = F1 = 1
. . . F;i = (; 1)i;1 Fi
an1x1 + an2x2 +    + annxn = bn
68 74 9 91 83 55 27 12 46 30

Fi = p15 i ; ^i
37 8 75 19 92 84 66 23 50 41
14 25 36 40 51 62 3 77 88 99
Let A = (aij ) and B be the column matrix (bi ). Then 21 32 43 54 65 6 10 89 97 78 Cassini's identity: for i > 0:
there is a unique solution i det A 6= 0. Let Ai be A
with column i replaced by B. Then
42 53 64 5 16 20 31 98 79 87 Fi+1 Fi;1 ; Fi2 = (;1)i :
xi = det Ai
det A :
The Fibonacci number system: Additive rule:
Every integer n has a unique Fn+k = Fk Fn+1 + Fk;1Fn
representation F2n = FnFn+1 + Fn;1Fn:
Improvement makes strait roads, but the crooked n = Fk1 + Fk2 +    + Fkm Calculation
roads without Improvement, are roads of Genius. where ki  ki+1 + 2 for all i,  F F by matrices:  n
{ William Blake (The Marriage of Heaven and Hell) n;2 n;1 = 0 1 :
1  i < m and km  2. F n;1 F n 1 1

You might also like