Theoretical Computer Science Cheat Sheet Definitions Series ... - TUG
Theoretical Computer Science Cheat Sheet Definitions Series ... - TUG
Theoretical Computer Science Cheat Sheet Definitions Series ... - TUG
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
f(n) = O(g(n))<br />
f(n) = Ω(g(n))<br />
<strong>Definitions</strong><br />
iff ∃ positive c, n 0 such that<br />
0 ≤ f(n) ≤ cg(n) ∀n ≥ n 0 .<br />
iff ∃ positive c, n 0 such that<br />
f(n) ≥ cg(n) ≥ 0 ∀n ≥ n 0 .<br />
f(n) = Θ(g(n)) iff f(n) = O(g(n)) and<br />
f(n) = Ω(g(n)).<br />
f(n) = o(g(n)) iff lim n→∞ f(n)/g(n) = 0.<br />
lim a n = a iff ∀ϵ > 0, ∃n 0 such that<br />
n→∞<br />
|a n − a| < ϵ, ∀n ≥ n 0 .<br />
sup S least b ∈ R such that b ≥ s,<br />
∀s ∈ S.<br />
inf S<br />
lim inf<br />
n→∞ a n<br />
greatest b ∈ R such that b ≤<br />
s, ∀s ∈ S.<br />
lim inf{a i | i ≥ n, i ∈ N}.<br />
n→∞<br />
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
n∑<br />
i =<br />
i=1<br />
In general:<br />
n∑<br />
i=1<br />
i=1<br />
n(n + 1)<br />
,<br />
2<br />
i m = 1<br />
m + 1<br />
n−1<br />
∑<br />
i m = 1<br />
m + 1<br />
i=0<br />
n∑<br />
i 2 =<br />
i=1<br />
[<br />
(n + 1) m+1 − 1 −<br />
m∑<br />
( m + 1<br />
k=0<br />
k<br />
<strong>Series</strong><br />
n(n + 1)(2n + 1)<br />
,<br />
6<br />
n∑<br />
i=1<br />
i 3 = n2 (n + 1) 2<br />
.<br />
4<br />
n∑ (<br />
(i + 1) m+1 − i m+1 − (m + 1)i m)]<br />
i=1<br />
)<br />
B k n m+1−k .<br />
Geometric series:<br />
n∑<br />
c i = cn+1 − 1<br />
c − 1 , c ≠ 1, ∑<br />
∞ c i = 1<br />
1 − c , ∑<br />
∞ c i =<br />
i=0<br />
i=0<br />
i=1<br />
n∑<br />
ic i = ncn+2 − (n + 1)c n+1 + c<br />
∞∑<br />
(c − 1) 2 , c ≠ 1, ic i =<br />
Harmonic series:<br />
n∑ 1<br />
H n =<br />
i ,<br />
n ∑<br />
i=0<br />
n(n + 1) n(n − 1)<br />
iH i = H n − .<br />
2<br />
4<br />
n∑<br />
( ( ) (<br />
i n + 1<br />
H i =<br />
m)<br />
m + 1<br />
c , |c| < 1,<br />
1 − c<br />
c<br />
, |c| < 1.<br />
(1 − c)<br />
2<br />
lim sup a n lim sup{a i | i ≥ n, i ∈ N}.<br />
i=1 i=1<br />
n→∞<br />
n→∞<br />
( n∑<br />
H i = (n + 1)H n − n,<br />
H n+1 − 1 )<br />
n<br />
k)<br />
Combinations: Size k subsets<br />
of a size n set.<br />
m + 1<br />
.<br />
i=1<br />
i=1<br />
[ n<br />
]<br />
(<br />
k<br />
Stirling numbers (1st kind): n n!<br />
Arrangements of an n element<br />
set into k cycles.<br />
( n<br />
1. =<br />
k)<br />
(n − k)!k! , 2. ∑<br />
n ( ( ( )<br />
n n n<br />
= 2<br />
k)<br />
n , 3. = ,<br />
k)<br />
n − k<br />
k=0<br />
4. =<br />
k)<br />
n ( )<br />
( ( ) ( )<br />
{ n − 1<br />
n n − 1 n − 1<br />
n<br />
}<br />
, 5. = + ,<br />
k<br />
Stirling numbers (2nd kind):<br />
k k − 1<br />
k)<br />
k k − 1<br />
Partitions of an n element ( )( ) ( )( )<br />
n m n n − k<br />
n∑<br />
( ) ( )<br />
r + k r + n + 1<br />
set into k non-empty sets. 6.<br />
=<br />
, 7.<br />
=<br />
,<br />
⟨ m k k m − k<br />
k<br />
n<br />
n<br />
⟩<br />
k=0<br />
n∑<br />
( ( )<br />
k n + 1<br />
n∑<br />
( )( ) ( )<br />
k<br />
1st order Eulerian numbers:<br />
r s r + s<br />
Permutations π 1 π 2 . . . π n on 8. = , 9.<br />
= ,<br />
m)<br />
m + 1<br />
k n − k n<br />
{1, 2, . . . , n} with k ascents.<br />
k=0<br />
( ( )<br />
k=0<br />
{ } {<br />
⟨ n<br />
⟩<br />
n k − n − 1<br />
n n<br />
10. = (−1)<br />
k)<br />
k , 11. = = 1,<br />
k<br />
2nd order Eulerian numbers.<br />
k<br />
1 n}<br />
C { }<br />
{ } { } { }<br />
n Catalan Numbers: Binary<br />
n n n − 1 n − 1<br />
trees with n + 1 vertices. 12. = 2 n−1 − 1, 13. = k + ,<br />
2 k k k − 1<br />
[ ]<br />
[ ]<br />
[ [ ] { }<br />
n n n n n<br />
14. = (n − 1)!, 15. = (n − 1)!H n−1 , 16. = 1, 17. ≥ ,<br />
1 2 n]<br />
k k<br />
[ ] [ ] [ ] { } [ ] ( n n − 1 n − 1<br />
n n n<br />
n∑<br />
[ ] n<br />
18. = (n − 1) + , 19. = = , 20. = n!, 21. C n =<br />
k k k − 1<br />
n − 1 n − 1 2)<br />
1 ) 2n<br />
,<br />
k n + 1(<br />
n<br />
⟨ ⟩ ⟨ ⟩<br />
⟨ ⟩ ⟨ ⟩<br />
⟨ ⟩ k=0 ⟨ ⟩ ⟨ ⟩<br />
n n<br />
n n<br />
n n − 1<br />
n − 1<br />
22. = = 1, 23. =<br />
, 24. = (k + 1) + (n − k) ,<br />
0 n − 1<br />
k n − 1 − k<br />
k k<br />
k − 1<br />
⟨ ⟩ 0<br />
{ ⟨ ⟩<br />
⟨ ⟩<br />
( )<br />
1 if k = 0,<br />
n n n + 1<br />
25. =<br />
26. = 2 n − n − 1, 27. = 3 n − (n + 1)2 n + ,<br />
k 0 otherwise<br />
1 2 2<br />
n∑<br />
⟨ ⟩( )<br />
⟨ n x + k<br />
n<br />
m∑<br />
( )<br />
{ n + 1<br />
n<br />
n∑<br />
⟨ ⟩( )<br />
n k<br />
28. x n =<br />
, 29. =<br />
(m + 1 − k)<br />
k n<br />
m⟩<br />
n (−1) k , 30. m! =<br />
,<br />
k<br />
m}<br />
k n − m<br />
k=0<br />
k=0<br />
k=0<br />
⟨ n<br />
n∑<br />
{ }( )<br />
⟨ ⟩<br />
⟨ ⟩<br />
n n − k<br />
n n<br />
31. =<br />
(−1)<br />
m⟩<br />
n−k−m k!, 32. = 1, 33. = 0 for n ≠ 0,<br />
k m<br />
0<br />
n<br />
k=0<br />
⟨ ⟩ ⟨ ⟩<br />
⟨ ⟩<br />
n n − 1<br />
n − 1<br />
n∑<br />
⟨ ⟩ n<br />
34. = (k + 1) + (2n − 1 − k) , 35.<br />
= (2n)n<br />
k<br />
k<br />
k − 1<br />
k 2 n ,<br />
k=0<br />
{ } x<br />
n∑<br />
⟨ ⟩( )<br />
{ }<br />
n x + n − 1 − k<br />
n + 1<br />
36. =<br />
, 37.<br />
= ∑ ( ){ n k<br />
n∑<br />
{ k<br />
= (m + 1)<br />
x − n k 2n<br />
m + 1 k m}<br />
m}<br />
n−k ,<br />
k=0<br />
k<br />
k=0
38.<br />
40.<br />
42.<br />
44.<br />
46.<br />
48.<br />
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
Identities Cont.<br />
[ ] n + 1<br />
= ∑ [ ]( n k<br />
n∑<br />
[ k<br />
n∑<br />
] [ ]<br />
= n<br />
m + 1 k m)<br />
m]<br />
n−k 1 k x<br />
n∑<br />
⟨ ⟩( )<br />
n x + k<br />
= n!<br />
, 39. =<br />
,<br />
k![<br />
m<br />
x − n k 2n<br />
{<br />
k<br />
k=0<br />
k=0<br />
k=0<br />
n<br />
=<br />
m}<br />
∑ ( ){ }<br />
[ n k + 1<br />
n<br />
(−1) n−k , 41. =<br />
k m + 1<br />
m]<br />
∑ [ ]( )<br />
n + 1 k<br />
(−1) m−k ,<br />
k + 1 m<br />
k<br />
k<br />
{ }<br />
m + n + 1<br />
m∑<br />
{ }<br />
[ ]<br />
n + k<br />
m + n + 1<br />
m∑<br />
[ ] n + k<br />
= k , 43.<br />
= k(n + k) ,<br />
m<br />
k<br />
m<br />
k<br />
(<br />
k=0<br />
k=0<br />
n<br />
=<br />
m)<br />
∑ { }[ ]<br />
( n + 1 k n<br />
(−1) m−k , 45. (n − m)! =<br />
k + 1 m<br />
m)<br />
∑ [ ]{ }<br />
n + 1 k<br />
(−1) m−k , for n ≥ m,<br />
k + 1 m<br />
{ }<br />
k<br />
k<br />
n<br />
= ∑ ( )( )[ ] [ ]<br />
m − n m + n m + k<br />
n<br />
, 47. = ∑ ( )( ){ }<br />
m − n m + n m + k<br />
,<br />
n − m m + k n + k k<br />
n − m m + k n + k k<br />
{ }(<br />
k<br />
)<br />
k<br />
n l + m<br />
= ∑ { }{ }( [ ]( )<br />
k n − k n n l + m<br />
, 49.<br />
=<br />
l + m l<br />
l m k)<br />
∑ [ ][ ]( k n − k n<br />
.<br />
l + m l<br />
l m k)<br />
k<br />
k<br />
Trees<br />
Every tree with n<br />
vertices has n − 1<br />
edges.<br />
Kraft inequality:<br />
If the depths<br />
of the leaves of<br />
a binary tree are<br />
d 1 , . . . , d n :<br />
n∑<br />
2 −d i<br />
≤ 1,<br />
i=1<br />
and equality holds<br />
only if every internal<br />
node has 2<br />
sons.<br />
Master method:<br />
T (n) = aT (n/b) + f(n), a ≥ 1, b > 1<br />
If ∃ϵ > 0 such that f(n) = O(n log b a−ϵ )<br />
then<br />
T (n) = Θ(n log b a ).<br />
If f(n) = Θ(n log b a ) then<br />
T (n) = Θ(n log b a log 2 n).<br />
If ∃ϵ > 0 such that f(n) = Ω(n log b a+ϵ ),<br />
and ∃c < 1 such that af(n/b) ≤ cf(n)<br />
for large n, then<br />
T (n) = Θ(f(n)).<br />
Substitution (example): Consider the<br />
following recurrence<br />
T i+1 = 2 2i · T 2 i , T 1 = 2.<br />
Note that T i is always a power of two.<br />
Let t i = log 2 T i . Then we have<br />
t i+1 = 2 i + 2t i , t 1 = 1.<br />
Let u i = t i /2 i . Dividing both sides of<br />
the previous equation by 2 i+1 we get<br />
t i+1 2i<br />
=<br />
2i+1 2 i+1 + t i<br />
2 i .<br />
Substituting we find<br />
u i+1 = 1 2 + u i, u 1 = 1 2 ,<br />
which is simply u i = i/2. So we find<br />
that T i has the closed form T i = 2 i2i−1 .<br />
Summing factors (example): Consider<br />
the following recurrence<br />
T (n) = 3T (n/2) + n, T (1) = 1.<br />
Rewrite so that all terms involving T<br />
are on the left side<br />
T (n) − 3T (n/2) = n.<br />
Now expand the recurrence, and choose<br />
a factor which makes the left side “telescope”<br />
Recurrences<br />
1 ( T (n) − 3T (n/2) = n )<br />
3 ( T (n/2) − 3T (n/4) = n/2 )<br />
. . .<br />
3 log n−1( 2<br />
T (2) − 3T (1) = 2 )<br />
Let m = log 2 n. Summing the left side<br />
we get T (n) − 3 m T (1) = T (n) − 3 m =<br />
T (n) − n k where k = log 2 3 ≈ 1.58496.<br />
Summing the right side we get<br />
m−1<br />
∑<br />
m−1<br />
n ∑ (<br />
2 i 3i = n 3<br />
) i<br />
2 .<br />
i=0<br />
i=0<br />
Let c = 3 2<br />
. Then we have<br />
m−1<br />
∑<br />
( c<br />
n c i m )<br />
− 1<br />
= n<br />
c − 1<br />
i=0<br />
= 2n(c log 2 n − 1)<br />
= 2n(c (k−1) log c n − 1)<br />
= 2n k − 2n,<br />
and so T (n) = 3n k − 2n. Full history recurrences<br />
can often be changed to limited<br />
history ones (example): Consider<br />
∑i−1<br />
T i = 1 + T j , T 0 = 1.<br />
Note that<br />
j=0<br />
T i+1 = 1 +<br />
Subtracting we find<br />
T i+1 − T i = 1 +<br />
= T i .<br />
i∑<br />
T j .<br />
j=0<br />
i∑ ∑i−1<br />
T j − 1 −<br />
j=0<br />
And so T i+1 = 2T i = 2 i+1 .<br />
j=0<br />
T j<br />
Generating functions:<br />
1. Multiply both sides of the equation<br />
by x i .<br />
2. Sum both sides over all i for<br />
which the equation is valid.<br />
3. Choose a generating function<br />
G(x). Usually G(x) = ∑ ∞<br />
i=0 xi g i .<br />
3. Rewrite the equation in terms of<br />
the generating function G(x).<br />
4. Solve for G(x).<br />
5. The coefficient of x i in G(x) is g i .<br />
Example:<br />
g i+1 = 2g i + 1, g 0 = 0.<br />
Multiply and sum:<br />
∑<br />
i≥0<br />
g i+1 x i = ∑ i≥0<br />
2g i x i + ∑ i≥0<br />
x i .<br />
We choose G(x) = ∑ i≥0 xi g i . Rewrite<br />
in terms of G(x):<br />
G(x) − g 0<br />
= 2G(x) + ∑ x i .<br />
x<br />
i≥0<br />
Simplify:<br />
G(x)<br />
= 2G(x) + 1<br />
x<br />
1 − x .<br />
Solve for G(x):<br />
x<br />
G(x) =<br />
(1 − x)(1 − 2x) .<br />
Expand this ( using partial fractions:<br />
2<br />
G(x) = x<br />
1 − 2x − 1 )<br />
1 − x<br />
⎛<br />
⎞<br />
= x ⎝2 ∑ 2 i x i − ∑ x i ⎠<br />
i≥0 i≥0<br />
So g i = 2 i − 1.<br />
= ∑ i≥0(2 i+1 − 1)x i+1 .
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
π ≈ 3.14159, e ≈ 2.71828, γ ≈ 0.57721, ϕ = 1+√ 5<br />
2<br />
≈ 1.61803, ˆϕ =<br />
1− √ 5<br />
2<br />
≈ −.61803<br />
i 2 i p i General Probability<br />
1 2 2 Bernoulli Numbers (B i = 0, odd i ≠ 1):<br />
2 4 3<br />
3 8 5<br />
4 16 7<br />
5 32 11<br />
6 64 13<br />
7 128 17<br />
8 256 19<br />
9 512 23<br />
10 1,024 29<br />
11 2,048 31<br />
12 4,096 37<br />
13 8,192 41<br />
14 16,384 43<br />
15 32,768 47<br />
16 65,536 53<br />
17 131,072 59<br />
18 262,144 61<br />
19 524,288 67<br />
20 1,048,576 71<br />
21 2,097,152 73<br />
22 4,194,304 79<br />
23 8,388,608 83<br />
24 16,777,216 89<br />
25 33,554,432 97<br />
26 67,108,864 101<br />
27 134,217,728 103<br />
B 0 = 1, B 1 = − 1 2 , B 2 = 1 6 , B 4 = − 1 30 ,<br />
B 6 = 1<br />
42 , B 8 = − 1<br />
30 , B 10 = 5 66 .<br />
Change of base, quadratic formula:<br />
log b x = log a x<br />
log a b ,<br />
Euler’s number e:<br />
−b ± √ b 2 − 4ac<br />
.<br />
2a<br />
e = 1 + 1 2 + 1 6 + 1 24 + 1<br />
120<br />
(<br />
+ · · ·<br />
lim 1 + x n<br />
= e<br />
n→∞ n) x .<br />
( )<br />
1 +<br />
1 n (<br />
n < e < 1 +<br />
1 n+1<br />
n)<br />
.<br />
( )<br />
1 +<br />
1 n e<br />
n = e −<br />
2n + 11e ( ) 1<br />
24n 2 − O n 3 .<br />
Harmonic numbers:<br />
1, 3 2 , 11<br />
6 , 25<br />
12 , 137<br />
60 , 49<br />
20 , 363<br />
140 , 761<br />
280 , 7129<br />
2520 , . . .<br />
ln n < H n < ln n + 1,<br />
( 1<br />
H n = ln n + γ + O .<br />
n)<br />
Factorial, Stirling’s approximation:<br />
1, 2, 6, 24, 120, 720, 5040, 40320, 362880, . . .<br />
n! = √ ( ) n ( ( n 1<br />
2πn 1 + Θ .<br />
e n))<br />
Ackermann’s ⎧ function and inverse:<br />
⎨ 2 j i = 1<br />
a(i, j) = a(i − 1, 2) j = 1<br />
⎩<br />
a(i − 1, a(i, j − 1)) i, j ≥ 2<br />
α(i) = min{j | a(j, j) ≥ i}.<br />
28 268,435,456 107 Binomial distribution:<br />
(<br />
29 536,870,912 109<br />
n<br />
Pr[X = k] = p<br />
k)<br />
k q n−k , q = 1 − p,<br />
30 1,073,741,824 113<br />
n∑<br />
(<br />
31 2,147,483,648 127<br />
n<br />
E[X] = k p<br />
k)<br />
k q n−k = np.<br />
32 4,294,967,296 131<br />
k=1<br />
Pascal’s Triangle<br />
Poisson distribution:<br />
Pr[X = k] = e−λ λ k<br />
1<br />
, E[X] = λ.<br />
k!<br />
1 1<br />
Normal (Gaussian) distribution:<br />
1 2 1<br />
p(x) = √ 1 e −(x−µ)2 /2σ 2 , E[X] = µ.<br />
1 3 3 1<br />
2πσ<br />
1 4 6 4 1<br />
The “coupon collector”: We are given a<br />
1 5 10 10 5 1<br />
random coupon each day, and there are n<br />
different types of coupons. The distribution<br />
of coupons is uniform. The expected<br />
1 6 15 20 15 6 1<br />
1 7 21 35 35 21 7 1<br />
number of days to pass before we to collect<br />
all n types is<br />
1 8 28 56 70 56 28 8 1<br />
1 9 36 84 126 126 84 36 9 1<br />
nH n .<br />
1 10 45 120 210 252 210 120 45 10 1<br />
Continuous distributions: If<br />
Pr[a < X < b] =<br />
∫ b<br />
a<br />
p(x) dx,<br />
then p is the probability density function of<br />
X. If<br />
Pr[X < a] = P (a),<br />
then P is the distribution function of X. If<br />
P and p both exist then<br />
P (a) =<br />
∫ a<br />
−∞<br />
p(x) dx.<br />
Expectation: If X is discrete<br />
E[g(X)] = ∑ g(x) Pr[X = x].<br />
x<br />
If X continuous then<br />
E[g(X)] =<br />
∫ ∞<br />
−∞<br />
g(x)p(x) dx =<br />
Variance, standard deviation:<br />
∫ ∞<br />
−∞<br />
VAR[X] = E[X 2 ] − E[X] 2 ,<br />
g(x) dP (x).<br />
σ = √ VAR[X].<br />
For events A and B:<br />
Pr[A ∨ B] = Pr[A] + Pr[B] − Pr[A ∧ B]<br />
Pr[A ∧ B] = Pr[A] · Pr[B],<br />
iff A and B are independent.<br />
Pr[A ∧ B]<br />
Pr[A|B] =<br />
Pr[B]<br />
For random variables X and Y :<br />
E[X · Y ] = E[X] · E[Y ],<br />
if X and Y are independent.<br />
E[X + Y ] = E[X] + E[Y ],<br />
E[cX] = c E[X].<br />
Bayes’ theorem:<br />
Pr[B|A i ] Pr[A i ]<br />
Pr[A i |B] = ∑ n<br />
j=1 Pr[A j] Pr[B|A j ] .<br />
Inclusion-exclusion:<br />
[ ∨<br />
n ] n∑<br />
Pr X i = Pr[X i ] +<br />
i=1<br />
i=1<br />
n∑<br />
(−1) k+1<br />
k=2<br />
Moment inequalities:<br />
∑<br />
i i
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
Trigonometry Matrices More Trig.<br />
Multiplication:<br />
(0,1)<br />
C = A · B,<br />
n∑<br />
c i,j = a i,k b k,j .<br />
b<br />
(cos θ, sin θ)<br />
k=1<br />
C<br />
A<br />
θ<br />
Determinants: det A ≠ 0 iff A is non-singular.<br />
(-1,0) (1,0)<br />
det A · B = det A · det B,<br />
c a<br />
(0,-1)<br />
B<br />
det A = ∑ n∏<br />
sign(π)a i,π(i) .<br />
Pythagorean theorem:<br />
π i=1<br />
C 2 = A 2 + B 2 .<br />
2 × 2 and 3 × 3 determinant:<br />
<strong>Definitions</strong>:<br />
∣ a b<br />
c d ∣ = ad − bc,<br />
sin a = A/C, cos a = B/C,<br />
csc a = C/A, sec a = C/B,<br />
a b c<br />
∣ ∣ ∣ ∣∣∣ tan a = sin a<br />
cos a = A B , cos a<br />
cot a =<br />
sin a = B d e f<br />
A . ∣ g h i ∣ = g b c<br />
∣∣∣ e f ∣ − h a c<br />
∣∣∣ d f ∣ + i a b<br />
d e ∣<br />
aei + bfg + cdh<br />
Area, radius of inscribed circle:<br />
=<br />
− ceg − fha − ibd.<br />
1<br />
2 AB, AB<br />
A + B + C .<br />
Permanents:<br />
Identities:<br />
perm A = ∑ n∏<br />
a i,π(i) .<br />
sin x = 1<br />
csc x , cos x = 1<br />
π<br />
sec x ,<br />
i=1<br />
Hyperbolic Functions<br />
tan x = 1<br />
cot x , sin2 x + cos 2 x = 1,<br />
<strong>Definitions</strong>:<br />
sinh x = ex − e −x<br />
, cosh x = ex + e −x<br />
,<br />
1 + tan 2 x = sec 2 x, 1 + cot 2 x = csc 2 x,<br />
sin x = cos ( π<br />
2 − x) , sin x = sin(π − x),<br />
cos x = − cos(π − x),<br />
tan x = cot ( π<br />
2 − x) ,<br />
cot x = − cot(π − x), csc x = cot x 2<br />
− cot x,<br />
sin(x ± y) = sin x cos y ± cos x sin y,<br />
cos(x ± y) = cos x cos y ∓ sin x sin y,<br />
tan x ± tan y<br />
tan(x ± y) =<br />
1 ∓ tan x tan y ,<br />
cot x cot y ∓ 1<br />
cot(x ± y) =<br />
cot x ± cot y ,<br />
sin 2x = 2 sin x cos x, sin 2x = 2 tan x<br />
1 + tan 2 x ,<br />
cos 2x = cos 2 x − sin 2 x, cos 2x = 2 cos 2 x − 1,<br />
cos 2x = 1 − 2 sin 2 x,<br />
tan 2x =<br />
cos 2x = 1 − tan2 x<br />
1 + tan 2 x ,<br />
2 tan x<br />
1 − tan 2 x , cot 2x = cot2 x − 1<br />
2 cot x ,<br />
sin(x + y) sin(x − y) = sin 2 x − sin 2 y,<br />
cos(x + y) cos(x − y) = cos 2 x − sin 2 y.<br />
Euler’s equation:<br />
e ix = cos x + i sin x, e iπ = −1.<br />
v2.02 c⃝1994 by Steve Seiden<br />
sseiden@acm.org<br />
http://www.csc.lsu.edu/~seiden<br />
2<br />
2<br />
tanh x = ex − e −x<br />
1<br />
e x , csch x =<br />
+ e−x sinh x ,<br />
sech x = 1<br />
cosh x , coth x = 1<br />
tanh x .<br />
Identities:<br />
cosh 2 x − sinh 2 x = 1, tanh 2 x + sech 2 x = 1,<br />
coth 2 x − csch 2 x = 1, sinh(−x) = − sinh x,<br />
cosh(−x) = cosh x, tanh(−x) = − tanh x,<br />
sinh(x + y) = sinh x cosh y + cosh x sinh y,<br />
cosh(x + y) = cosh x cosh y + sinh x sinh y,<br />
sinh 2x = 2 sinh x cosh x,<br />
cosh 2x = cosh 2 x + sinh 2 x,<br />
cosh x + sinh x = e x , cosh x − sinh x = e −x ,<br />
(cosh x + sinh x) n = cosh nx + sinh nx, n ∈ Z,<br />
2 sinh 2 x 2 = cosh x − 1, 2 cosh2 x 2<br />
= cosh x + 1.<br />
θ sin θ cos θ tan θ<br />
0 0 1 0<br />
π<br />
6<br />
π<br />
4<br />
π<br />
3<br />
π<br />
1<br />
2<br />
√<br />
2<br />
2<br />
√<br />
3<br />
2<br />
√ √<br />
3 3<br />
2 3<br />
√<br />
2<br />
2<br />
1<br />
√<br />
1<br />
2 3<br />
2<br />
1 0 ∞<br />
. . . in mathematics<br />
you don’t understand<br />
things, you<br />
just get used to<br />
them.<br />
– J. von Neumann<br />
b<br />
C<br />
h<br />
a<br />
A c<br />
Law of cosines:<br />
B<br />
c 2 = a 2 +b 2 −2ab cos C.<br />
Area:<br />
A = 1 2 hc,<br />
= 1 2ab sin C,<br />
= c2 sin A sin B<br />
.<br />
2 sin C<br />
Heron’s formula:<br />
A = √ s · s a · s b · s c ,<br />
s = 1 2<br />
(a + b + c),<br />
s a = s − a,<br />
s b = s − b,<br />
s c = s − c.<br />
More identities:<br />
√<br />
1 − cos x<br />
sin x 2 = ,<br />
2<br />
√<br />
1 + cos x<br />
cos x 2 = ,<br />
2<br />
√<br />
1 − cos x<br />
tan x 2 = 1 + cos x ,<br />
= 1 − cos x<br />
sin x ,<br />
= sin x<br />
1 + cos x ,<br />
cot x 2 = √<br />
1 + cos x<br />
1 − cos x ,<br />
= 1 + cos x<br />
sin x ,<br />
= sin x<br />
1 − cos x ,<br />
sin x = eix − e −ix<br />
,<br />
2i<br />
cos x = eix + e −ix<br />
,<br />
2<br />
tan x = −i eix − e −ix<br />
e ix + e −ix ,<br />
= −i e2ix − 1<br />
e 2ix + 1 ,<br />
sinh ix<br />
sin x = ,<br />
i<br />
cos x = cosh ix,<br />
tanh ix<br />
tan x = .<br />
i
Number Theory<br />
The Chinese remainder theorem: There exists<br />
a number C such that:<br />
C ≡ r 1 mod m 1<br />
.<br />
.<br />
.<br />
C ≡ r n mod m n<br />
if m i and m j are relatively prime for i ≠ j.<br />
Euler’s function: ϕ(x) is the number of<br />
positive integers less than x relatively<br />
prime to x. If ∏ n<br />
i=1 pe i<br />
i is the prime factorization<br />
of x then<br />
n∏<br />
ϕ(x) = p ei−1<br />
i (p i − 1).<br />
i=1<br />
Euler’s theorem: If a and b are relatively<br />
prime then<br />
1 ≡ a ϕ(b) mod b.<br />
Fermat’s theorem:<br />
1 ≡ a p−1 mod p.<br />
The Euclidean algorithm: if a > b are integers<br />
then<br />
gcd(a, b) = gcd(a mod b, b).<br />
If ∏ n<br />
then<br />
i=1 pe i<br />
i<br />
is the prime factorization of x<br />
S(x) = ∑ d|x<br />
d =<br />
n∏<br />
i=1<br />
p e i+1<br />
i − 1<br />
p i − 1 .<br />
Perfect Numbers: x is an even perfect number<br />
iff x = 2 n−1 (2 n −1) and 2 n −1 is prime.<br />
Wilson’s theorem: n is a prime iff<br />
(n − 1)! ≡ −1 mod n.<br />
Möbius ⎧inversion:<br />
1 if i = 1.<br />
⎪⎨<br />
0 if i is not square-free.<br />
µ(i) =<br />
⎪⎩ (−1) r if i is the product of<br />
r distinct primes.<br />
If<br />
then<br />
G(a) = ∑ d|a<br />
F (a) = ∑ d|a<br />
F (d),<br />
( a<br />
µ(d)G .<br />
d)<br />
Prime numbers:<br />
ln ln n<br />
p n = n ln n + n ln ln n − n + n<br />
( )<br />
ln n<br />
n<br />
+ O ,<br />
ln n<br />
π(n) =<br />
n<br />
ln n + n<br />
(ln n) 2 + 2!n<br />
(ln n)<br />
( )<br />
3<br />
n<br />
+ O<br />
(ln n) 4 .<br />
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
<strong>Definitions</strong>:<br />
Graph Theory<br />
Loop An edge connecting a vertex<br />
to itself.<br />
Directed Each edge has a direction.<br />
Simple Graph with no loops or<br />
multi-edges.<br />
Walk A sequence v 0 e 1 v 1 . . . e l v l .<br />
Trail A walk with distinct edges.<br />
Path A trail with distinct<br />
vertices.<br />
Connected A graph where there exists<br />
a path between any two<br />
vertices.<br />
Component A maximal connected<br />
subgraph.<br />
Tree A connected acyclic graph.<br />
Free tree A tree with no root.<br />
DAG Directed acyclic graph.<br />
Eulerian Graph with a trail visiting<br />
each edge exactly once.<br />
Hamiltonian Graph with a cycle visiting<br />
each vertex exactly once.<br />
Cut A set of edges whose removal<br />
increases the number<br />
of components.<br />
Cut-set A minimal cut.<br />
Cut edge A size 1 cut.<br />
k-Connected A graph connected with<br />
the removal of any k − 1<br />
vertices.<br />
k-Tough ∀S ⊆ V, S ≠ ∅ we have<br />
k · c(G − S) ≤ |S|.<br />
k-Regular A graph where all vertices<br />
have degree k.<br />
k-Factor A k-regular spanning<br />
subgraph.<br />
Matching A set of edges, no two of<br />
which are adjacent.<br />
Clique A set of vertices, all of<br />
which are adjacent.<br />
Ind. set A set of vertices, none of<br />
which are adjacent.<br />
Vertex cover A set of vertices which<br />
cover all edges.<br />
Planar graph A graph which can be embeded<br />
in the plane.<br />
Plane graph An embedding of a planar<br />
graph.<br />
∑<br />
deg(v) = 2m.<br />
v∈V<br />
If G is planar then n − m + f = 2, so<br />
f ≤ 2n − 4, m ≤ 3n − 6.<br />
Any planar graph has a vertex with degree<br />
≤ 5.<br />
Notation:<br />
E(G) Edge set<br />
V (G) Vertex set<br />
c(G) Number of components<br />
G[S] Induced subgraph<br />
deg(v) Degree of v<br />
∆(G) Maximum degree<br />
δ(G) Minimum degree<br />
χ(G) Chromatic number<br />
χ E (G) Edge chromatic number<br />
G c Complement graph<br />
K n Complete graph<br />
K n1 ,n 2<br />
Complete bipartite graph<br />
r(k, l) Ramsey number<br />
Geometry<br />
Projective coordinates: triples<br />
(x, y, z), not all x, y and z zero.<br />
(x, y, z) = (cx, cy, cz) ∀c ≠ 0.<br />
Cartesian<br />
Projective<br />
(x, y) (x, y, 1)<br />
y = mx + b (m, −1, b)<br />
x = c (1, 0, −c)<br />
Distance formula, L p and L ∞<br />
metric:<br />
√<br />
(x1 − x 0 ) 2 + (y 1 − y 0 ) 2 ,<br />
[<br />
|x1 − x 0 | p + |y 1 − y 0 | p] 1/p<br />
,<br />
[<br />
lim |x1 − x 0 | p + |y 1 − y 0 | p] 1/p<br />
.<br />
p→∞<br />
Area of triangle (x 0 , y 0 ), (x 1 , y 1 )<br />
and (x 2 , y 2 ):<br />
∣ ∣<br />
1 ∣∣∣<br />
2 abs x 1 − x 0 y 1 − y 0 ∣∣∣<br />
.<br />
x 2 − x 0 y 2 − y 0<br />
Angle formed by three points:<br />
θ<br />
(0, 0)<br />
l 2<br />
l 1<br />
(x 2 , y 2 )<br />
(x 1 , y 1 )<br />
cos θ = (x 1, y 1 ) · (x 2 , y 2 )<br />
.<br />
l 1 l 2<br />
Line through two points (x 0 , y 0 )<br />
and (x 1 , y 1 ):<br />
x y 1<br />
x 0 y 0 1<br />
∣ x 1 y 1 1 ∣ = 0.<br />
Area of circle, volume of sphere:<br />
A = πr 2 , V = 4 3 πr3 .<br />
If I have seen farther than others,<br />
it is because I have stood on the<br />
shoulders of giants.<br />
– Issac Newton
Wallis’ identity:<br />
π = 2 · 2 · 2 · 4 · 4 · 6 · 6 · · ·<br />
1 · 3 · 3 · 5 · 5 · 7 · · ·<br />
π<br />
Brouncker’s continued fraction expansion:<br />
π<br />
4 = 1 + 1 2<br />
3<br />
2 + 2<br />
2+ 52<br />
2+<br />
2+···<br />
72<br />
Gregrory’s series:<br />
π<br />
4 = 1 − 1 3 + 1 5 − 1 7 + 1 9 − · · ·<br />
Newton’s series:<br />
π<br />
6 = 1 2 + 1<br />
2 · 3 · 2 3 + 1 · 3<br />
2 · 4 · 5 · 2 5 + · · ·<br />
Sharp’s series:<br />
π<br />
6 = √ 1 (<br />
1 − 1<br />
3 3 1 · 3 + 1<br />
3 2 · 5 − 1 )<br />
3 3 · 7 + · · ·<br />
Euler’s series:<br />
π 2<br />
6 = 1 1 2 + 1 2 2 + 1 3 2 + 1 4 2 + 1 5 2 + · · ·<br />
π 2<br />
8 = 1 1 2 + 1 3 2 + 1 5 2 + 1 7 2 + 1 9 2 + · · ·<br />
π 2<br />
12 = 1 1 2 − 1 2 2 + 1 3 2 − 1 4 2 + 1 5 2 − · · ·<br />
Partial Fractions<br />
Let N(x) and D(x) be polynomial functions<br />
of x. We can break down<br />
N(x)/D(x) using partial fraction expansion.<br />
First, if the degree of N is greater<br />
than or equal to the degree of D, divide<br />
N by D, obtaining<br />
N(x)<br />
D(x) = Q(x) + N ′ (x)<br />
D(x) ,<br />
where the degree of N ′ is less than that of<br />
D. Second, factor D(x). Use the following<br />
rules: For a non-repeated factor:<br />
N(x)<br />
(x − a)D(x) = A<br />
x − a + N ′ (x)<br />
D(x) ,<br />
where<br />
A =<br />
[ ] N(x)<br />
.<br />
D(x)<br />
x=a<br />
For a repeated factor:<br />
m−1<br />
N(x)<br />
(x − a) m D(x) = ∑ A k (x)<br />
(x − a) m−k +N′ D(x) ,<br />
where<br />
A k = 1 k!<br />
k=0<br />
[ ( )]<br />
d<br />
k N(x)<br />
dx k .<br />
D(x)<br />
x=a<br />
The reasonable man adapts himself to the<br />
world; the unreasonable persists in trying<br />
to adapt the world to himself. Therefore<br />
all progress depends on the unreasonable.<br />
– George Bernard Shaw<br />
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
Derivatives:<br />
1. d(cu)<br />
dx<br />
4. d(un )<br />
dx<br />
7. d(cu )<br />
dx<br />
9.<br />
11.<br />
13.<br />
15.<br />
17.<br />
19.<br />
21.<br />
23.<br />
25.<br />
27.<br />
29.<br />
d(sin u)<br />
dx<br />
d(tan u)<br />
dx<br />
d(sec u)<br />
dx<br />
Calculus<br />
= cdu<br />
d(u + v)<br />
, 2. = du<br />
dx dx<br />
du<br />
= nun−1<br />
dx ,<br />
du<br />
= (ln c)cu<br />
dx<br />
d(arcsin u)<br />
dx<br />
d(arctan u)<br />
dx<br />
d(arcsec u)<br />
dx<br />
d(sinh u)<br />
dx<br />
d(tanh u)<br />
dx<br />
d(sech u)<br />
dx<br />
d(arcsinh u)<br />
dx<br />
d(arctanh u)<br />
dx<br />
dx + dv<br />
dx ,<br />
d(u/v)<br />
5. = v( du<br />
dx<br />
dx<br />
d(uv)<br />
3.<br />
dx<br />
= u dv<br />
dx + v du<br />
dx ,<br />
) (<br />
− u<br />
dv<br />
)<br />
dx<br />
v 2 , 6. d(ecu )<br />
dx<br />
, 8.<br />
d(ln u)<br />
dx<br />
cu du<br />
= ce<br />
dx ,<br />
= 1 du<br />
u dx ,<br />
= cos u du<br />
d(cos u)<br />
, 10. = − sin u du<br />
dx dx<br />
dx ,<br />
= sec 2 u du<br />
d(cot u)<br />
, 12. = csc 2 u du<br />
dx dx<br />
dx ,<br />
= tan u sec u du<br />
d(csc u)<br />
, 14. = − cot u csc u du<br />
dx dx<br />
dx ,<br />
=<br />
1 du<br />
d(arccos u)<br />
√ , 16. = −1 du<br />
√<br />
1 − u<br />
2 dx dx 1 − u<br />
2 dx ,<br />
= 1 du<br />
1 + u 2 dx<br />
1<br />
=<br />
u √ du<br />
1 − u 2 dx<br />
, 18.<br />
d(arccot u)<br />
dx<br />
, 20.<br />
d(arccsc u)<br />
dx<br />
=<br />
= −1<br />
1 + u 2 du<br />
dx ,<br />
−1<br />
u √ du<br />
1 − u 2 dx ,<br />
= cosh u du<br />
d(cosh u)<br />
, 22. = sinh u du<br />
dx dx<br />
dx ,<br />
= sech 2 u du<br />
d(coth u)<br />
, 24. = − csch 2 u du<br />
dx dx<br />
dx ,<br />
= − sech u tanh u du<br />
d(csch u)<br />
, 26. = − csch u coth u du<br />
dx dx<br />
dx ,<br />
1 du<br />
d(arccosh u) 1 du<br />
= √ , 28. = √<br />
1 + u<br />
2 dx dx u2 − 1 dx ,<br />
= 1 du<br />
d(arccoth u)<br />
1 − u 2 , 30. = 1 du<br />
dx dx u 2 − 1 dx ,<br />
d(arcsech u) −1<br />
31. =<br />
dx u √ du<br />
d(arccsch u)<br />
, 32. =<br />
1 − u 2 dx dx<br />
Integrals:<br />
∫ ∫<br />
∫<br />
∫<br />
1. cu dx = c u dx, 2. (u + v) dx =<br />
3.<br />
6.<br />
8.<br />
10.<br />
12.<br />
14.<br />
−1<br />
|u| √ du<br />
1 + u 2 dx .<br />
∫<br />
u dx +<br />
v dx,<br />
∫<br />
x n dx = 1<br />
∫ ∫<br />
1<br />
n + 1 xn+1 , n ≠ −1, 4.<br />
x dx = ln x, 5. e x dx = e x ,<br />
∫<br />
∫<br />
dx<br />
1 + x 2 = arctan x, 7. u dv ∫<br />
dx dx = uv − v du<br />
dx dx,<br />
∫<br />
∫<br />
sin x dx = − cos x, 9. cos x dx = sin x,<br />
∫<br />
∫<br />
∫<br />
tan x dx = − ln | cos x|, 11.<br />
sec x dx = ln | sec x + tan x|, 13.<br />
arcsin x a dx = arcsin x a + √ a 2 − x 2 , a > 0,<br />
∫<br />
∫<br />
cot x dx = ln | cos x|,<br />
csc x dx = ln | csc x + cot x|,
15.<br />
17.<br />
19.<br />
21.<br />
23.<br />
25.<br />
26.<br />
29.<br />
33.<br />
36.<br />
∫<br />
∫<br />
∫<br />
∫<br />
∫<br />
∫<br />
∫<br />
∫<br />
∫<br />
∫<br />
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
Calculus Cont.<br />
arccos x a dx = arccos x a − √ a 2 − x 2 , a > 0, 16.<br />
∫<br />
arctan x a dx = x arctan x a − a 2 ln(a2 + x 2 ), a > 0,<br />
∫<br />
sin 2 ( )<br />
(ax)dx = 1<br />
2a ax − sin(ax) cos(ax) , 18. cos 2 )<br />
(ax)dx =<br />
2a( 1 ax + sin(ax) cos(ax) ,<br />
∫<br />
sec 2 x dx = tan x, 20. csc 2 x dx = − cot x,<br />
sin n x dx = − sinn−1 x cos x<br />
n<br />
∫<br />
−<br />
tan n x dx = tann−1 x<br />
n − 1<br />
sec n x dx = tan x secn−1 x<br />
n − 1<br />
+ n − 1<br />
n<br />
∫<br />
sin n−2 x dx, 22.<br />
tan n−2 x dx, n ≠ 1, 24.<br />
+ n − 2 ∫<br />
n − 1<br />
sec n−2 x dx, n ≠ 1,<br />
∫<br />
∫<br />
cos n x dx = cosn−1 x sin x<br />
n<br />
cot n x dx = − cotn−1 x<br />
n − 1<br />
+ n − 1 ∫<br />
cos n−2 x dx,<br />
n<br />
∫<br />
−<br />
cot n−2 x dx, n ≠ 1,<br />
csc n x dx = − cot x cscn−1 x<br />
+ n − 2 ∫<br />
∫<br />
∫<br />
csc n−2 x dx, n ≠ 1, 27. sinh x dx = cosh x, 28. cosh x dx = sinh x,<br />
n − 1 n − 1<br />
∫<br />
∫<br />
∫<br />
tanh x dx = ln | cosh x|, 30. coth x dx = ln | sinh x|, 31. sech x dx = arctan sinh x, 32. csch x dx = ln ∣ ∣tanh x ∣<br />
2<br />
,<br />
∫<br />
∫<br />
sinh 2 x dx = 1 4 sinh(2x) − 1 2 x,<br />
34. cosh 2 x dx = 1 4 sinh(2x) + 1 2 x,<br />
35. sech 2 x dx = tanh x,<br />
arcsinh x a dx = x arcsinh x a − √ x 2 + a 2 , a > 0, 37.<br />
∫<br />
arctanh x a dx = x arctanh x a + a 2 ln |a2 − x 2 |,<br />
38.<br />
39.<br />
40.<br />
42.<br />
43.<br />
46.<br />
48.<br />
50.<br />
52.<br />
54.<br />
56.<br />
58.<br />
60.<br />
⎧<br />
∫<br />
⎨ x arccosh x<br />
arccosh x a dx = a − √ x 2 + a 2 , if arccosh x a<br />
> 0 and a > 0,<br />
⎩<br />
x arccosh x a + √ x 2 + a 2 , if arccosh x a<br />
< 0 and a > 0,<br />
∫<br />
dx<br />
(<br />
√<br />
a2 + x = ln x + √ )<br />
a 2 + x 2 , a > 0,<br />
2<br />
∫<br />
∫<br />
∫<br />
dx<br />
√a2<br />
a 2 + x 2 = 1 a arctan x a , a > 0, 41. √<br />
− x 2 dx = x 2 a2 − x 2 + a2<br />
2 arcsin x a , a > 0,<br />
(a 2 − x 2 ) 3/2 dx = x 8 (5a2 − 2x 2 ) √ a 2 − x 2 + 3a4<br />
8 arcsin x a , a > 0,<br />
∫<br />
∫<br />
dx<br />
√<br />
a2 − x = arcsin x 2 a , a > 0, 44. dx<br />
a 2 − x 2 = 1 ∣ ∣∣∣<br />
2a ln a + x<br />
a − x∣ ,<br />
∫ √a2 √ ∣<br />
± x 2 dx = x ∣∣x<br />
2 a2 ± x 2 ± a2<br />
2 ln √ ∣ ∫<br />
∣∣<br />
+ a2 ± x 2 , 47.<br />
∫<br />
dx<br />
ax 2 + bx = 1 ∣ ∣∣∣<br />
a ln x<br />
a + bx∣ ,<br />
∫<br />
45. dx<br />
(a 2 − x 2 ) = x<br />
3/2 a 2√ a 2 − x , 2<br />
dx<br />
∣ ∣∣x<br />
√<br />
x2 − a = ln √ ∣ ∣∣ + x2 − a 2 , a > 0,<br />
2<br />
∫<br />
49. x √ 2(3bx − 2a)(a + bx)3/2<br />
a + bx dx =<br />
15b 2 ,<br />
∫ √<br />
a + bx<br />
dx = 2 √ ∫<br />
∫<br />
1<br />
a + bx + a<br />
x<br />
x √ a + bx dx,<br />
51. x<br />
√ dx = 1<br />
√ √ ∣ √ ln<br />
a + bx − a∣∣∣<br />
a + bx 2<br />
∣√ √ , a > 0,<br />
a + bx + a<br />
∫ √<br />
a2 − x 2<br />
dx = √ a<br />
x<br />
2 − x 2 a + √ a<br />
− a ln<br />
2 − x 2<br />
∫<br />
∣ x ∣ ,<br />
53. x √ a 2 − x 2 dx = − 1 3 (a2 − x 2 ) 3/2 ,<br />
∫<br />
x 2√ a 2 − x 2 dx = x 8 (2x2 − a 2 ) √ ∫<br />
∣<br />
a 2 − x 2 + a4<br />
8 arcsin x a , a > 0, 55. dx<br />
∣∣∣∣<br />
√<br />
a2 − x = − 1 2 a ln a + √ a 2 − x 2<br />
x ∣ ,<br />
∫<br />
∫<br />
x dx<br />
√<br />
a2 − x = −√ a 2 − x 2 x 2 dx<br />
, 57. √ 2 a2 − x = − √ x<br />
2 2 a2 − x 2 + a2<br />
2 arcsin x a,<br />
a > 0,<br />
∫ √<br />
a2 + x 2<br />
dx = √ a<br />
x<br />
2 + x 2 a + √ a<br />
− a ln<br />
2 + x 2<br />
∫ √ ∣ x ∣ , 59. x2 − a 2<br />
dx = √ x<br />
x<br />
2 − a 2 − a arccos a<br />
|x| , a > 0,<br />
∫<br />
x √ ∫<br />
∣ ∣<br />
x 2 ± a 2 dx = 1 3 (x2 ± a 2 ) 3/2 dx<br />
∣∣∣<br />
, 61.<br />
x √ x 2 + a = 1 2 a ln x ∣∣∣<br />
a + √ ,<br />
a 2 + x 2
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
Calculus Cont.<br />
∫<br />
∫<br />
√<br />
dx<br />
62.<br />
x √ x 2 − a = 1 2 a arccos a<br />
|x| , a > 0, 63. dx<br />
x 2√ x 2 ± a = ∓ x2 ± a 2<br />
2 a 2 ,<br />
x<br />
∫<br />
x dx<br />
64. √<br />
x2 ± a = √ ∫ √<br />
x2<br />
x 2 ± a 2 ± a<br />
, 65.<br />
2<br />
2 x 4 dx = ∓ (x2 + a 2 ) 3/2<br />
3a 2 x 3 ,<br />
∣<br />
1 ∣∣∣∣<br />
∫<br />
⎧⎪<br />
dx ⎨ √<br />
66.<br />
ax 2 + bx + c = b2 − 4ac ln 2ax + b − √ b 2 − 4ac<br />
2ax + b + √ b 2 − 4ac∣ , if b2 > 4ac,<br />
⎪ ⎩<br />
67.<br />
68.<br />
69.<br />
∫<br />
2<br />
√<br />
4ac − b<br />
2 arctan<br />
2ax + b √<br />
4ac − b<br />
2 ,<br />
if b2 < 4ac,<br />
1<br />
∣<br />
⎧⎪<br />
dx ⎨ √a ln ∣2ax + b + 2 √ a √ ax 2 + bx + c∣ , if a > 0,<br />
√<br />
ax2 + bx + c = ⎪ 1 ⎩ √ arcsin √ −2ax − b , if a < 0,<br />
−a b2 − 4ac<br />
∫ √ax2<br />
+ bx + c dx = 2ax + b √ ∫<br />
4ax − b2<br />
ax2 + bx + c +<br />
4a<br />
8a<br />
∫<br />
√<br />
x dx<br />
√<br />
ax2 + bx + c = ax2 + bx + c<br />
− b ∫<br />
a 2a<br />
dx<br />
√<br />
ax2 + bx + c ,<br />
dx<br />
√<br />
ax2 + bx + c ,<br />
−1<br />
2<br />
∫<br />
⎧⎪ √ c √ ax<br />
dx ⎨ √ ln<br />
2 + bx + c + bx + 2c<br />
, if c > 0,<br />
c<br />
70.<br />
x √ ax 2 + bx + c = ∣<br />
x<br />
∣<br />
⎪ 1<br />
bx + 2c<br />
⎩ √ arcsin −c |x| √ , if c < 0,<br />
b 2 − 4ac<br />
∫<br />
71. x 3√ x 2 + a 2 dx = ( 1 3 x2 − 2<br />
15 a2 )(x 2 + a 2 ) 3/2 ,<br />
∫<br />
∫<br />
72. x n sin(ax) dx = − 1 a xn cos(ax) + n a<br />
x n−1 cos(ax) dx,<br />
∫<br />
∫<br />
73. x n cos(ax) dx = 1 a xn sin(ax) − n a<br />
x n−1 sin(ax) dx,<br />
∫<br />
74. x n e ax dx = xn e ax ∫<br />
− n<br />
a<br />
a<br />
x n−1 e ax dx,<br />
∫<br />
( )<br />
ln(ax)<br />
75. x n ln(ax) dx = x n+1 n + 1 − 1<br />
(n + 1) 2 ,<br />
∫<br />
76. x n (ln ax) m dx = xn+1<br />
n + 1 (ln ax)m −<br />
m ∫<br />
x n (ln ax) m−1 dx.<br />
n + 1<br />
x 1 = x 1 = x 1<br />
x 2 = x 2 + x 1 = x 2 − x 1<br />
x 3 = x 3 + 3x 2 + x 1 = x 3 − 3x 2 + x 1<br />
x 4 = x 4 + 6x 3 + 7x 2 + x 1 = x 4 − 6x 3 + 7x 2 − x 1<br />
x 5 = x 5 + 15x 4 + 25x 3 + 10x 2 + x 1 = x 5 − 15x 4 + 25x 3 − 10x 2 + x 1<br />
x 1 = x 1 x 1 = x 1<br />
x 2 = x 2 + x 1 x 2 = x 2 − x 1<br />
x 3 = x 3 + 3x 2 + 2x 1 x 3 = x 3 − 3x 2 + 2x 1<br />
x 4 = x 4 + 6x 3 + 11x 2 + 6x 1 x 4 = x 4 − 6x 3 + 11x 2 − 6x 1<br />
x 5 = x 5 + 10x 4 + 35x 3 + 50x 2 + 24x 1 x 5 = x 5 − 10x 4 + 35x 3 − 50x 2 + 24x 1<br />
Finite Calculus<br />
Difference, shift operators:<br />
∆f(x) = f(x + 1) − f(x),<br />
E f(x) = f(x + 1).<br />
Fundamental Theorem:<br />
f(x) = ∆F (x) ⇔ ∑ f(x)δx = F (x) + C.<br />
b∑ ∑b−1<br />
f(x)δx = f(i).<br />
a<br />
Differences:<br />
∆(cu) = c∆u,<br />
∆(uv) = u∆v + E v∆u,<br />
∆(x n ) = nx n−1 ,<br />
i=a<br />
∆(u + v) = ∆u + ∆v,<br />
∆(H x ) = x −1 , ∆(2 x ) = 2 x ,<br />
∆(c x ) = (c − 1)c x , ∆ ( ) (<br />
x<br />
m = x<br />
m−1)<br />
.<br />
Sums:<br />
∑ ∑ cu δx = c u δx,<br />
∑ (u + v) δx =<br />
∑ u δx +<br />
∑ v δx,<br />
∑ u∆v δx = uv −<br />
∑<br />
E v∆u δx,<br />
∑ x n δx = xn+1<br />
m+1 , ∑ x −1 δx = H x ,<br />
∑ c x δx = cx<br />
c−1 , ∑ ( x<br />
) (<br />
m δx = x<br />
m+1)<br />
.<br />
Falling Factorial Powers:<br />
x n = x(x − 1) · · · (x − n + 1), n > 0,<br />
x 0 = 1,<br />
x n 1<br />
=<br />
(x + 1) · · · (x + |n|) , n < 0,<br />
x n+m = x m (x − m) n .<br />
Rising Factorial Powers:<br />
x n = x(x + 1) · · · (x + n − 1), n > 0,<br />
x 0 = 1,<br />
x n 1<br />
=<br />
(x − 1) · · · (x − |n|) , n < 0,<br />
x n+m = x m (x + m) n .<br />
Conversion:<br />
x n = (−1) n (−x) n = (x − n + 1) n<br />
= 1/(x + 1) −n ,<br />
x n = (−1) n (−x) n = (x + n − 1) n<br />
= 1/(x − 1) −n ,<br />
n∑<br />
{ } n<br />
n∑<br />
{ } n<br />
x n = x k = (−1) n−k x k ,<br />
k k<br />
x n =<br />
x n =<br />
k=1<br />
n∑<br />
k=1<br />
n∑<br />
k=1<br />
k=1<br />
[ n<br />
k<br />
]<br />
(−1) n−k x k ,<br />
[ n<br />
k<br />
]<br />
x k .
Taylor’s series:<br />
Expansions:<br />
f(x) = f(a) + (x − a)f ′ (a) +<br />
1<br />
1 − x<br />
1<br />
1 − cx<br />
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
(x − a)2<br />
f ′′ (a) + · · · =<br />
2<br />
<strong>Series</strong><br />
∞∑ (x − a) i<br />
f (i) (a).<br />
i!<br />
i=0<br />
= 1 + x + x 2 + x 3 + x 4 + · · · =<br />
= 1 + cx + c 2 x 2 + c 3 x 3 + · · · =<br />
1<br />
1 − x n = 1 + x n + x 2n + x 3n + · · · =<br />
∞∑<br />
x i ,<br />
i=0<br />
∞∑<br />
c i x i ,<br />
i=0<br />
∞∑<br />
x ni ,<br />
x<br />
∞∑<br />
(1 − x) 2 = x + 2x 2 + 3x 3 + 4x 4 + · · · = ix i ,<br />
i=0<br />
n∑<br />
{ n k!z<br />
k<br />
∞∑<br />
k}<br />
(1 − z) k+1 = x + 2 n x 2 + 3 n x 3 + 4 n x 4 + · · · = i n x i ,<br />
k=0<br />
i=0<br />
∞∑<br />
e x = 1 + x + 1 2 x2 + 1 x i<br />
6 x3 + · · · =<br />
i! ,<br />
i=0<br />
∞∑<br />
ln(1 + x) = x − 1 2 x2 + 1 3 x3 − 1 4 x4 i+1 xi<br />
− · · · = (−1)<br />
i ,<br />
i=1<br />
1<br />
∞∑<br />
ln<br />
= x + 1<br />
1 − x<br />
2 x2 + 1 3 x3 + 1 x i<br />
4 x4 + · · · =<br />
i ,<br />
i=1<br />
∞∑<br />
sin x = x − 1 3! x3 + 1 5! x5 − 1 7! x7 + · · · = (−1) i x 2i+1<br />
(2i + 1)! ,<br />
cos x = 1 − 1 2! x2 + 1 4! x4 − 1 6! x6 + · · · =<br />
tan −1 x = x − 1 3 x3 + 1 5 x5 − 1 7 x7 + · · · =<br />
(1 + x) n = 1 + nx + n(n−1)<br />
2<br />
x 2 + · · · =<br />
1<br />
(1 − x) n+1 = 1 + (n + 1)x + ( )<br />
n+2<br />
2 x 2 + · · · =<br />
x<br />
e x − 1<br />
= 1 − 1 2 x + 1<br />
12 x2 − 1<br />
720 x4 + · · · =<br />
1<br />
2x (1 − √ 1 − 4x) = 1 + x + 2x 2 + 5x 3 + · · · =<br />
1<br />
√ 1 − 4x<br />
= 1 + 2x + 6x 2 + 20x 3 + · · · =<br />
( √<br />
1 1 − 1 − 4x<br />
√ 1 − 4x 2x<br />
1<br />
1 − x ln 1<br />
1 − x<br />
(<br />
ln<br />
1<br />
2<br />
1<br />
1 − x<br />
) n<br />
= 1 + (2 + n)x + ( )<br />
4+n<br />
2 x 2 + · · · =<br />
= x + 3 2 x2 + 11<br />
6 x3 + 25<br />
12 x4 + · · · =<br />
) 2<br />
= 1 2 x2 + 3 4 x3 + 11<br />
24 x4 + · · · =<br />
x<br />
1 − x − x 2 = x + x 2 + 2x 3 + 3x 4 + · · · =<br />
F n x<br />
1 − (F n−1 + F n+1 )x − (−1) n x 2 = F n x + F 2n x 2 + F 3n x 3 + · · · =<br />
i=0<br />
i=0<br />
∞∑<br />
i=0<br />
(−1) i x2i<br />
(2i)! ,<br />
∞∑<br />
(−1) i x 2i+1<br />
(2i + 1) ,<br />
∞∑<br />
( ) n<br />
x i ,<br />
i<br />
i=0<br />
i=0<br />
∞∑<br />
( i + n<br />
i<br />
i=0<br />
∞∑ B i x i<br />
,<br />
i!<br />
i=0<br />
∞∑<br />
(<br />
1 2i<br />
i + 1 i<br />
i=0<br />
∞∑<br />
( ) 2i<br />
x i ,<br />
i<br />
i=0<br />
∞∑<br />
( 2i + n<br />
i<br />
∞∑<br />
H i x i ,<br />
i=0<br />
i=1<br />
∞∑ H i−1 x i<br />
,<br />
i<br />
∞∑<br />
F i x i ,<br />
i=2<br />
i=0<br />
∞∑<br />
F ni x i .<br />
i=0<br />
)<br />
x i ,<br />
)<br />
x i ,<br />
)<br />
x i ,<br />
Ordinary power series:<br />
∞∑<br />
A(x) = a i x i .<br />
i=0<br />
Exponential power series:<br />
∞∑ x i<br />
A(x) = a i<br />
i! .<br />
i=0<br />
Dirichlet power series:<br />
∞∑ a i<br />
A(x) =<br />
i x .<br />
i=1<br />
Binomial theorem:<br />
n∑<br />
( n<br />
(x + y) n = x<br />
k)<br />
n−k y k .<br />
k=0<br />
Difference of like powers:<br />
n−1<br />
∑<br />
x n − y n = (x − y) x n−1−k y k .<br />
k=0<br />
For ordinary power series:<br />
∞∑<br />
αA(x) + βB(x) = (αa i + βb i )x i ,<br />
x k A(x) =<br />
i=0<br />
∞∑<br />
a i−k x i ,<br />
i=k<br />
A(x) − ∑ k−1<br />
i=0 a ix i<br />
x k =<br />
∫<br />
A(cx) =<br />
A ′ (x) =<br />
xA ′ (x) =<br />
A(x) dx =<br />
A(x) + A(−x)<br />
2<br />
A(x) − A(−x)<br />
2<br />
=<br />
=<br />
∞∑<br />
a i+k x i ,<br />
i=0<br />
∞∑<br />
c i a i x i ,<br />
i=0<br />
∞∑<br />
(i + 1)a i+1 x i ,<br />
i=0<br />
∞∑<br />
ia i x i ,<br />
i=1<br />
∞∑<br />
i=1<br />
a i−1<br />
x i ,<br />
i<br />
∞∑<br />
a 2i x 2i ,<br />
i=0<br />
∞∑<br />
a 2i+1 x 2i+1 .<br />
i=0<br />
Summation: If b i = ∑ i<br />
j=0 a i then<br />
B(x) = 1<br />
1 − x A(x).<br />
Convolution:<br />
⎛ ⎞<br />
∞∑ i∑<br />
A(x)B(x) = ⎝ a j b i−j<br />
⎠ x i .<br />
i=0<br />
j=0<br />
God made the natural numbers;<br />
all the rest is the work of man.<br />
– Leopold Kronecker
<strong>Theoretical</strong> <strong>Computer</strong> <strong>Science</strong> <strong>Cheat</strong> <strong>Sheet</strong><br />
<strong>Series</strong><br />
Expansions:<br />
1<br />
(1 − x) n+1 ln 1<br />
∞∑<br />
( ) ( ) −n n + i<br />
1<br />
= (H n+i − H n ) x i ,<br />
=<br />
1 − x<br />
i<br />
x<br />
i=0<br />
∞∑<br />
[ ] n<br />
x n = x i , (e x − 1) n =<br />
i<br />
∞∑<br />
i=0<br />
{ i<br />
n}<br />
x i ,<br />
∞∑<br />
{ i n!x<br />
i<br />
,<br />
n}<br />
i!<br />
i=0<br />
i=0<br />
( ) n<br />
1<br />
∞∑<br />
[ i n!x<br />
i<br />
∞∑ (−4)<br />
ln<br />
=<br />
, x cot x =<br />
1 − x<br />
n] i B 2i x 2i<br />
,<br />
i!<br />
(2i)!<br />
i=0<br />
i=0<br />
∞∑<br />
tan x = (−1) i−1 22i (2 2i − 1)B 2i x 2i−1<br />
∞∑ 1<br />
, ζ(x) =<br />
(2i)!<br />
i x ,<br />
i=1<br />
i=1<br />
1<br />
∞∑ µ(i)<br />
=<br />
ζ(x)<br />
i x , ζ(x − 1)<br />
∞∑<br />
=<br />
ζ(x)<br />
i=1<br />
ζ(x) = ∏ p<br />
∞∑<br />
ζ 2 (x) =<br />
ζ(x)ζ(x − 1) =<br />
i=1<br />
∞∑<br />
i=1<br />
1<br />
1 − p −x ,<br />
d(i)<br />
x i where d(n) = ∑ d|n 1,<br />
S(i)<br />
x i where S(n) = ∑ d|n d,<br />
ζ(2n) = 22n−1 |B 2n |<br />
π 2n , n ∈ N,<br />
(2n)!<br />
x<br />
∞∑<br />
= (−1) i−1 (4i − 2)B 2i x 2i<br />
,<br />
sin x<br />
(2i)!<br />
2x<br />
i=0<br />
( √ ) n<br />
1 − 1 − 4x<br />
∞∑<br />
=<br />
e x sin x =<br />
√<br />
1 − √ 1 − x<br />
=<br />
x<br />
( ) 2 arcsin x<br />
=<br />
x<br />
i=0<br />
∞∑<br />
i=1<br />
∞∑<br />
i=0<br />
∞∑<br />
i=0<br />
n(2i + n − 1)!<br />
x i ,<br />
i!(n + i)!<br />
2 i/2 sin iπ 4<br />
i!<br />
x i ,<br />
(4i)!<br />
16 i√ 2(2i)!(2i + 1)! xi ,<br />
4 i i! 2<br />
(i + 1)(2i + 1)! x2i .<br />
Cramer’s Rule<br />
If we have equations:<br />
a 1,1 x 1 + a 1,2 x 2 + · · · + a 1,n x n = b 1<br />
i=1<br />
ϕ(i)<br />
i x , Stieltjes Integration<br />
Escher’s Knot<br />
If G is continuous in the interval [a, b] and F is nondecreasing then<br />
exists. If a ≤ b ≤ c then<br />
∫ c<br />
a<br />
G(x) dF (x) =<br />
∫ b<br />
a<br />
∫ b<br />
a<br />
G(x) dF (x)<br />
G(x) dF (x) +<br />
∫ c<br />
If the integrals involved exist<br />
∫ b<br />
∫<br />
( ) b<br />
G(x) + H(x) dF (x) = G(x) dF (x) +<br />
a<br />
∫ b<br />
a<br />
∫ b<br />
a<br />
∫ b<br />
G(x) d ( F (x) + H(x) ) =<br />
a<br />
c · G(x) dF (x) =<br />
∫ b<br />
a<br />
a<br />
∫ b<br />
a<br />
b<br />
G(x) dF (x) +<br />
G(x) d ( c · F (x) ) = c<br />
G(x) dF (x) = G(b)F (b) − G(a)F (a) −<br />
G(x) dF (x).<br />
∫ b<br />
a<br />
∫ b<br />
a<br />
∫ b<br />
a<br />
∫ b<br />
a<br />
H(x) dF (x),<br />
G(x) dH(x),<br />
G(x) dF (x),<br />
F (x) dG(x).<br />
If the integrals involved exist, and F possesses a derivative F ′ at every<br />
point in [a, b] then<br />
∫ b<br />
∫ b<br />
G(x) dF (x) = G(x)F ′ (x) dx.<br />
00 47 18 76 29 93 85 34 61 52<br />
13, 21, 34, 55, 89, . . .<br />
86 11 57 28 70 39 94 45 02 63<br />
det A . Additive rule:<br />
95 80 22 67 38 71 49 56 13 04<br />
59 96 81 33 07 48 72 60 24 15<br />
1, 1, 2, 3, 5, 8,<br />
<strong>Definitions</strong>:<br />
73 69 90 82 44 17 58 01 35 26 F i = F i−1 +F i−2 , F 0 = F 1 = 1,<br />
.<br />
68 74 09 91 83 55 27 12 46 30<br />
F −i = (−1) i−1 F i ,<br />
37 08 75 19 92 84 66 23 50 41<br />
F<br />
14 25 36 40 51 62 03 77 88 99<br />
i = √ 1 5<br />
(ϕ i − ˆϕ i) ,<br />
21 32 43 54 65 06 10 89 97 78 Cassini’s identity: for i > 0:<br />
42 53 64 05 16 20 31 98 79 87<br />
F i+1 F i−1 − Fi 2 = (−1) i .<br />
a 2,1 x 1 + a 2,2 x 2 + · · · + a 2,n x n = b 2<br />
. .<br />
a n,1 x 1 + a n,2 x 2 + · · · + a n,n x n = b n<br />
Let A = (a i,j ) and B be the column matrix (b i ). Then<br />
there is a unique solution iff det A ≠ 0. Let A i be A<br />
with column i replaced by B. Then<br />
x i = det A i<br />
Improvement makes strait roads, but the crooked<br />
roads without Improvement, are roads of Genius.<br />
– William Blake (The Marriage of Heaven and Hell)<br />
The Fibonacci number system:<br />
Every integer n has a unique<br />
representation<br />
n = F k1 + F k2 + · · · + F km ,<br />
where k i ≥ k i+1 + 2 for all i,<br />
1 ≤ i < m and k m ≥ 2.<br />
a<br />
a<br />
Fibonacci Numbers<br />
F n+k = F k F n+1 + F k−1 F n ,<br />
F 2n = F n F n+1 + F n−1 F n .<br />
Calculation by matrices:<br />
( ) ( ) n<br />
Fn−2 F n−1 0 1<br />
= .<br />
F n−1 F n 1 1