Embed
Email

cheat

Document Sample

Categories
Tags
Stats
views:
10
posted:
12/9/2011
language:
pages:
10
Theoretical Computer Science Cheat Sheet

Definitions Series

f (n) = O(g(n)) iff ∃ positive c, n0 such that n n n

n(n + 1) n(n + 1)(2n + 1) n2 (n + 1)2

0 ≤ f (n) ≤ cg(n) ∀n ≥ n0 . i= , i2 = , i3 = .

i=1

2 i=1

6 i=1

4

f (n) = Ω(g(n)) iff ∃ positive c, n0 such that

In general:

f (n) ≥ cg(n) ≥ 0 ∀n ≥ n0 . n n

1

f (n) = Θ(g(n)) iff f (n) = O(g(n)) and im = (n + 1)m+1 − 1 − (i + 1)m+1 − im+1 − (m + 1)im

i=1

m+1 i=1

f (n) = Ω(g(n)).

n−1 m

1 m+1

f (n) = o(g(n)) iff limn→∞ f (n)/g(n) = 0. im = Bk nm+1−k .

i=1

m+1 k

k=0

lim an = a iff ∀ > 0, ∃n0 such that

n→∞ Geometric series:

|an − a| 1 1 T (n) − 3T (n/2) = n 1. Multiply both sides of the equa-

3 T (n/2) − 3T (n/4) = n/2 tion by xi .

If ∃ > 0 such that f (n) = O(nlogb a− )

. . . 2. Sum both sides over all i for

then . . .

. . . which the equation is valid.

T (n) = Θ(nlogb a ).

3log2 n−1 T (2) − 3T (1) = 2 3. Choose a generating function



If f (n) = Θ(nlogb a ) then G(x). Usually G(x) = i=0 xi gi .

T (n) = Θ(nlogb a log2 n). Let m = log2 n. Summing the left side 3. Rewrite the equation in terms of

we get T (n) − 3m T (1) = T (n) − 3m = the generating function G(x).

If ∃ > 0 such that f (n) = Ω(nlogb a+ ), T (n) − nk where k = log2 3 ≈ 1.58496.

4. Solve for G(x).

and ∃c 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 L∞

n

If i=1 pei is the prime factorization of x ber of components. metric:

i

then Cut-set A minimal cut. (x1 − x0 )2 + (y1 − y0 )2 ,

pi i +1 − 1

n e Cut edge A size 1 cut. 1/p

S(x) = d= . k-Connected A graph connected with |x1 − x0 |p + |y1 − y0 |p ,

pi − 1

d|x i=1 the removal of any k − 1 lim |x1 − x0 |p + |y1 − y0 | p 1/p

.

Perfect Numbers: x is an even perfect num- vertices. p→∞



ber iff x = 2n−1 (2n −1) and 2n −1 is prime. k-Tough ∀S ⊆ V, S = ∅ we have Area of triangle (x0 , y0 ), (x1 , y1 )

Wilson’s theorem: n is a prime iff k · c(G − S) ≤ |S|. and (x2 , y2 ):

(n − 1)! ≡ −1 mod n. k-Regular A graph where all vertices 1 x1 − x0 y1 − y0

2 abs x − x .

have degree k. 2 0 y2 − y0

M¨bius 

o inversion: k-Factor A k-regular spanning

1 if i = 1. Angle formed by three points:

 subgraph.

0 if i is not square-free.

µ(i) = Matching A set of edges, no two of



 (−1)r if i is the product of (x2 , y2 )

r distinct primes. which are adjacent.

2

Clique A set of vertices, all of

If θ

which are adjacent.

G(a) = F (d), (0, 0) 1 (x1 , y1 )

Ind. set A set of vertices, none of

d|a

which are adjacent. (x1 , y1 ) · (x2 , y2 )

cos θ = .

then Vertex cover A set of vertices which 1 2

a

F (a) = µ(d)G . cover all edges. Line through two points (x0 , y0 )

d

d|a Planar graph A graph which can be em- and (x1 , y1 ):

Prime numbers: beded in the plane. x y 1

ln ln n Plane graph An embedding of a planar x0 y0 1 = 0.

pn = n ln n + n ln ln n − n + n

ln n graph. x1 y1 1

n Area of circle, volume of sphere:

+O , deg(v) = 2m.

ln n A = πr2 , V = 4 πr3 .

v∈V 3

n n 2!n

π(n) = + + If G is planar then n − m + f = 2, so

ln n (ln n)2 (ln n)3 If I have seen farther than others,

f ≤ 2n − 4, m ≤ 3n − 6. it is because I have stood on the

n

+O . Any planar graph has a vertex with de- shoulders of giants.

(ln n)4

gree ≤ 5. – Issac Newton

Theoretical Computer Science Cheat Sheet

π Calculus

Wallis’ identity: Derivatives:

2 · 2 · 4 · 4 · 6 · 6···

π =2· d(cu) du d(u + v) du dv d(uv) dv du

1 · 3 · 3 · 5 · 5 · 7··· 1. =c , 2. = + , 3. =u +v ,

dx dx dx dx dx dx dx dx

Brouncker’s continued fraction expansion:

12 d(un ) du d(u/v) v du − u dv

d(ecu ) du

π 4. = nun−1 , 5. = dx dx

, 6. = cecu ,

4 =1+ 32 dx dx dx v2 dx dx

2+ 52

2+

2+ 72 d(cu ) du d(ln u) 1 du

2+···

7. = (ln c)cu , 8. = ,

dx dx dx u dx

Gregrory’s series:

1 1 1 1

4 =1− 3 + − − ···

π

+ d(sin u) du d(cos u) du

5 7 9 9. = cos u , 10. = − sin u ,

dx dx dx dx

Newton’s series:

d(tan u) du d(cot u) du

1 1 1·3 11. = sec2 u , 12. = csc2 u ,

dx dx dx dx

6 = 2 + 2 · 3 · 23 + 2 · 4 · 5 · 25 + · · ·

π



d(sec u) du d(csc u) du

Sharp’s series: 13. = tan u sec u , 14. = − cot u csc u ,

dx dx dx dx

1 1 1 1 d(arcsin u) 1 du d(arccos u) −1 du

π

= √ 1− 1 + 2 − 3 +··· 15. =√ , 16. =√ ,

6 3 ·3 3 ·5 3 ·7 dx 1−u 2 dx dx 1 − u2 dx

3

Euler’s series: d(arctan u) 1 du d(arccot u) −1 du

17. = , 18. = ,

dx 1 + u2 dx dx 1 + u2 dx

π2 1 1 1 1 1

6 = 12 + 22 + 32 + 42 + 52 + ··· d(arcsec u) 1 du d(arccsc u) −1 du

π2 1 1 1 1 1

19. = √ , 20. = √ ,

u 1−u 2 dx u 1−u 2 dx

8 = 12 + 32 + 52 + 72 + 92 + ··· dx dx

π2 1 1 1 1 1 d(sinh u) du d(cosh u) du

12 = 12 − 22 + 32 − 42 + 52 − ··· 21. = cosh u , 22. = sinh u ,

dx dx dx dx

Partial Fractions d(tanh u) du d(coth u) du

23. = sech2 u , 24. = − csch2 u ,

Let N (x) and D(x) be polynomial func- dx dx dx dx

tions of x. We can break down d(sech u) du d(csch u) du

N (x)/D(x) using partial fraction expan- 25. = − sech u tanh u , 26. = − csch u coth u ,

dx dx dx dx

sion. First, if the degree of N is greater

than or equal to the degree of D, divide d(arcsinh u) 1 du d(arccosh u) 1 du

27. =√ , 28. =√ ,

dx 1+u 2 dx dx u 2 − 1 dx

N by D, obtaining

N (x) N (x) d(arctanh u) 1 du d(arccoth u) 1 du

= Q(x) + , 29. = , 30. = 2 ,

D(x) D(x) dx 1 − u2 dx dx u − 1 dx

where the degree of N is less than that of d(arcsech u) −1 du d(arccsch u) −1 du

31. = √ , 32. = √ .

D. Second, factor D(x). Use the follow- dx u 1 − u2 dx dx |u| 1 + u2 dx

ing rules: For a non-repeated factor: Integrals:

N (x) A N (x)

= + ,

(x − a)D(x) x−a D(x) 1. cu dx = c u dx, 2. (u + v) dx = u dx + v dx,

where

N (x) 1 1

A= . 3. xn dx = xn+1 , n = −1, 4. dx = ln x, 5. ex dx = ex ,

D(x) x=a

n+1 x

For a repeated factor: dx dv du

6. = arctan x, 7. u dx = uv − v dx,

N (x)

m−1

Ak N (x) 1 + x2 dx dx

= + ,

(x − a)m D(x) (x − a)m−k D(x) 8. sin x dx = − cos x, 9. cos x dx = sin x,

k=0



where

1 dk N (x) 10. tan x dx = − ln | cos x|, 11. cot x dx = ln | cos x|,

Ak = .

k! dxk D(x) x=a



12. sec x dx = ln | sec x + tan x|, 13. csc x dx = ln | csc x + cot x|,

The reasonable man adapts himself to the

world; the unreasonable persists in trying

to adapt the world to himself. Therefore 14. arcsin x dx = arcsin x +

a a a2 − x2 , a > 0,

all progress depends on the unreasonable.

– George Bernard Shaw

Theoretical Computer Science Cheat Sheet

Calculus Cont.



15. arccos x dx = arccos x −

a a a2 − x2 , a > 0, 16. arctan x dx = x arctan x −

a a

a

2 ln(a2 + x2 ), a > 0,



17. sin2 (ax)dx = 1

2a ax − sin(ax) cos(ax) , 18. cos2 (ax)dx = 1

2a ax + sin(ax) cos(ax) ,



19. sec2 x dx = tan x, 20. csc2 x dx = − cot x,



sinn−1 x cos x n − 1 cosn−1 x sin x n − 1

21. sinn x dx = − + sinn−2 x dx, 22. cosn x dx = + cosn−2 x dx,

n n n n

tann−1 x cotn−1 x

23. tann x dx = − tann−2 x dx, n = 1, 24. cotn x dx = − − cotn−2 x dx, n = 1,

n−1 n−1

tan x secn−1 x n − 2

25. secn x dx = + secn−2 x dx, n = 1,

n−1 n−1

cot x cscn−1 x n − 2

26. cscn x dx = − + cscn−2 x dx, n = 1, 27. sinh x dx = cosh x, 28. cosh x dx = sinh x,

n−1 n−1



29. 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 ,

2





33. sinh2 x dx = 1

4 sinh(2x) − 1 x,

2 34. cosh2 x dx = 1

4 sinh(2x) + 1 x,

2 35. sech2 x dx = tanh x,



36. arcsinh x dx = x arcsinh x −

a a x2 + a2 , a > 0, 37. arctanh x dx = x arctanh x +

a a

a

2 ln |a2 − x2 |,

 x

 x arccosh − x2 + a2 , if arccosh x > 0 and a > 0,

a

38. x

arccosh a dx = a

x

 x arccosh + x2 + a2 , if arccosh x 0,

a a



dx

39. √ = ln x + a2 + x2 , a > 0,

a2 + x2

dx 1 a2

40. = a arctan x , a > 0, 41. a2 − x2 dx = x

2 a2 − x2 + 2 arcsin x , a > 0,

a2 + x2 a a





3a4

42. (a2 − x2 )3/2 dx = x (5a2 − 2x2 ) a2 − x2 +

8 8 arcsin x ,

a a > 0,



dx dx 1 a+x dx x

43. √ = arcsin x , a > 0, 44. = ln , 45. = √ ,

a2 − x2 a a2 −x 2 2a a−x (a2 −x2 )3/2

a2 a2 − x2



a2 dx

46. a2 ± x2 dx = x

2 a2 ± x2 ± 2 ln x + a2 ± x2 , 47. √ = ln x + x2 − a2 , a > 0,

x2 − a2



dx 1 x √ 2(3bx − 2a)(a + bx)3/2

48. = ln , 49. x a + bx dx = ,

ax2 + bx a a + bx 15b2

√ √ √

a + bx √ 1 x 1 a + bx − a

50. dx = 2 a + bx + a √ dx, 51. √ dx = √ ln √ √ , a > 0,

x x a + bx a + bx 2 a + bx + a

√ √

a2 − x2 a + a2 − x2

52. dx = a2 − x2 − a ln , 53. x a2 − x2 dx = − 1 (a2 − x2 )3/2 ,

3

x x



2 2 2 a4 dx 1 a+ a2 − x2

54. x a2 − x2 dx = x

8 (2x −a ) a2 − x2 + 8 arcsin x

a, a > 0, 55. √ = − a ln ,

a2 − x2 x

x dx x2 dx 2

56. √ = − a2 − x2 , 57. √ = − x a2 − x2 + a arcsin a,

2 2

x

a > 0,

a2 − x2 a2 − x2

√ √ √

a2 + x2 2 + x2 − a ln

a + a2 + x2 x2 − a2

58. dx = a , 59. dx = x2 − a2 − a arccos |x| ,

a

a > 0,

x x x

dx x

60. x x2 ± a2 dx = 1 (x2 ± a2 )3/2 ,

3 61. √ = 1

ln √ ,

x x2 + a2 a

a+ a2 + x2

Theoretical Computer Science Cheat Sheet

Calculus Cont. Finite Calculus



dx 1 dx x2 ± a2 Difference, shift operators:

62. √ a

= a arccos |x| , a > 0, 63. √ = ,

x x 2 − a2 x2 x2 ± a2 a2 x ∆f (x) = f (x + 1) − f (x),



x dx x2 ± a2 (x2 + a2 )3/2 E f (x) = f (x + 1).

64. √ = x2 ± a2 , 65. dx = ,

x2 ± a2  x4 3a2 x3 Fundamental Theorem:





 1 2ax + b − b2 − 4ac f (x) = ∆F (x) ⇔ f (x)δx = F (x) + C.

√

 ln √ , if b2 > 4ac,

dx b2 − 4ac 2ax + b + b2 − 4ac

66. = b b−1

ax2 + bx + c   f (x)δx = f (i).

√ 2

 arctan √

2ax + b

, if b2 0,



1 ∆(cu) = c∆u, ∆(u + v) = ∆u + ∆v,

dx  a

67. √ = ∆(uv) = u∆v + E v∆u,

ax2 + bx + c  √1 arcsin √

 −2ax − b

 , if a 0,

dx x n+1

70. √ = xn δx = x

x−1 δx = Hx ,

2 + bx + c  1 m+1 ,

x ax  bx

 √ arcsin √ + 2c ,

 if c 0,



1

x0 = 1,

72. xn sin(ax) dx = − a xn cos(ax) + n

a xn−1 cos(ax) dx,

1

xn = , n 0,



75. xn ln(ax) dx = xn+1

ln(ax)



1

, x0 = 1,

n+1 (n + 1)2 1

xn = , n 0:

there is a unique solution iff det A = 0. Let Ai be A

with column i replaced by B. Then

42 53 64 05 16 20 31 98 79 87

Fi+1 Fi−1 − Fi2 = (−1)i .

det Ai Additive rule:

xi = . The Fibonacci number system:

det A Every integer n has a unique Fn+k = Fk Fn+1 + Fk−1 Fn ,

representation F2n = Fn Fn+1 + Fn−1 Fn .

Improvement makes strait roads, but the crooked n = Fk1 + Fk2 + · · · + Fkm , Calculation by matrices:

roads without Improvement, are roads of Genius. where ki ≥ ki+1 + 2 for all i, n

Fn−2 Fn−1 0 1

– William Blake (The Marriage of Heaven and Hell) 1 ≤ i < m and km ≥ 2. = .

Fn−1 Fn 1 1



Related docs
Other docs by Ahmed Said Ahm...
compeng
Views: 0  |  Downloads: 0
ocp
Views: 1  |  Downloads: 0
Arctic Sports
Views: 0  |  Downloads: 0
thegift
Views: 0  |  Downloads: 0
fiscal
Views: 2  |  Downloads: 0
sports 2
Views: 0  |  Downloads: 0
Micro Niche Adsense Course
Views: 25  |  Downloads: 0
faq
Views: 0  |  Downloads: 0
cheat
Views: 10  |  Downloads: 0
Articles_ESL
Views: 0  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!