Theoretical Computer Science <strong>Cheat</strong> <strong>Sheet</strong>Trigonometry Matrices More Trig.Multiplication:C(0,1)n∑C = A · B, c i,j = a i,k b k,j .bb a(cos θ, sin θ)k=1hCAθDeterminants: det A ≠0iffA is non-singular.(-1,0) (1,0)A c Bdet A · B = det A · det B,Law of cosines:c a(0,-1)Bdet A = ∑ n∏c 2 = a 2 +b 2 −2ab cos C.sign(π)a i,π(i) .Pythagorean theorem:πArea:i=1C 2 = A 2 + B 2 .2 × 2 and 3 × 3 determinant:Definitions:∣ a bA = 1 2 hc,c d∣ = ad − bc,= 1 2ab sin C,sin a = A/C, cos a = B/C,csc a = C/A, sec a = C/B,a b c∣ ∣ ∣ ∣∣∣ tan a = sin acos a = A B , cos acot a =sin a = B d e fA . ∣ g h i ∣ = g b c∣∣∣ e f ∣ − h a c∣∣∣ d f ∣ + i a b= c2 sin A sin B.d e∣2 sin CHeron’s formula:aei + bfg + cdhArea, radius of inscribed circle:=− ceg − fha− ibd.A = √ s · s a · s b · s c ,12 AB, ABA + B + C .Permanents:s = 1Identities:perm A = ∑ 2(a + b + c),n∏s a = s − a,a i,π(i) .sin x = 1csc x , cos x = 1sπsec x ,i=1b = s − b,Hyperbolic Functionss c = s − c.tan x = 1cot x , sin2 x + cos 2 x =1,Definitions:More identities:√1 − cos x1 + tan 2 x = sec 2 x, 1 + cot 2 x = csc 2 sinh x = ex − e −x, cosh x = ex + e −x, sin xx,2 = ,222sin x = cos ( π2 − x) tanh x = ex − e −x1, sin x = sin(π − x),e x , csch x =+ e−x sinh x ,cos x = − cos(π − x),tan x = cot ( π2 − x) ,cot x = − cot(π − x), csc x = cot x 2− cot x,sin(x ± y) = sin x cos y ± cos x sin y,cos(x ± y) = cos x cos y ∓ sin x sin y,tan x ± tan ytan(x ± y) =1 ∓ tan x tan y ,cot x cot y ∓ 1cot(x ± y) =cot x ± cot y ,sin 2x = 2 sin x cos x, sin 2x = 2 tan x1 + tan 2 x ,cos 2x = cos 2 x − sin 2 x, cos 2x = 2 cos 2 x − 1,cos 2x =1− 2 sin 2 x,cos 2x = 1 − tan2 x1 + tan 2 x ,tan 2x =2 tan x1 − tan 2 x , cot 2x = cot2 x − 12 cot x ,sin(x + y) sin(x − y) = sin 2 x − sin 2 y,cos(x + y) cos(x − y) = cos 2 x − sin 2 y.Euler’s equation:e ix = cos x + i sin x, e iπ = −1.v2.02 c○1994 by Steve Seidensseiden@acm.orghttp://www.csc.lsu.edu/~seidensech x = 1cosh x , coth x = 1tanh x .Identities:cosh 2 x − sinh 2 x =1, tanh 2 x + sech 2 x =1,coth 2 x − csch 2 x =1, sinh(−x) =− sinh x,cosh(−x) = cosh x, tanh(−x) =− tanh x,sinh(x + y) = sinh x cosh y + cosh x sinh y,cosh(x + y) = cosh x cosh y + sinh x sinh y,sinh 2x = 2 sinh x cosh x,cosh 2x = cosh 2 x + sinh 2 x,cosh x + sinh x = e x , cosh x − sinh x = e −x ,(cosh x + sinh x) n = cosh nx + sinh nx, n ∈ Z,2 sinh 2 x 2 = cosh x − 1, 2 cosh2 x 2= cosh x +1.θ sin θ cos θ tan θ0 0 1 0π6π4π3π12√22√32√ √3 32 3√221√12 321 0 ∞...in mathematicsyou don’t understandthings, youjust get used tothem.– J. von Neumann√1 + cos xcos x 2 = ,2√1 − cos xtan x 2 = 1 + cos x ,= 1 − cos xsin x ,= sin x1 + cos x ,√1 + cos xcot x 2 = 1 − cos x ,= 1 + cos xsin x ,= sin x1 − cos x ,sin x = eix − e −ix,2icos x = eix + e −ix,2tan x = −i eix − e −ixe ix + e −ix ,= −i e2ix − 1e 2ix +1 ,sinh ixsin x = ,icos x = cosh ix,tanh ixtan x = .i
Number TheoryThe Chinese remainder theorem: There existsa number C such that:C ≡ r 1 mod m 1...C ≡ r n mod m nif m i and m j are relatively prime for i ≠ j.Euler’s function: φ(x) is the number ofpositive integers less than x relativelyprime to x. If ∏ ni=1 pei i is the prime factorizationof x thenn∏φ(x) = p ei−1i (p i − 1).i=1Euler’s theorem: If a and b are relativelyprime then1 ≡ a φ(b) mod b.Fermat’s theorem:1 ≡ a p−1 mod p.The Euclidean algorithm: if a>bare integersthengcd(a, b) = gcd(a mod b, b).If ∏ nis the prime factorization of xtheni=1 pei iS(x) = ∑ d =d|xn∏i=1p ei+1i − 1p i − 1 .Perfect Numbers: x is an even perfect numberiff x =2 n−1 (2 n −1) and 2 n −1 is prime.Wilson’s theorem: n is a prime iff(n − 1)! ≡−1modn.Möbius ⎧inversion:1 if i =1.⎪⎨0 if i is not square-free.µ(i) =⎪⎩ (−1) r if i is the product ofr distinct primes.IfG(a) = ∑ F (d),d|athenF (a) = ∑ ( a)µ(d)G .dd|aPrime numbers:ln ln np n = n ln n + n ln ln n − n + n( )ln nn+ O ,ln nπ(n) =nln n + n(ln n) 2 + 2!n(ln n)( )3n+ O(ln n) 4 .Theoretical Computer Science <strong>Cheat</strong> <strong>Sheet</strong>Graph TheoryDefinitions:Loop An edge connecting a vertexto itself.Directed Each edge has a direction.Simple Graph with no loops ormulti-edges.Walk A sequence v 0 e 1 v 1 ...e l v l .Trail A walk with distinct edges.Path A trail with distinctvertices.Connected A graph where there existsa path between any twovertices.Component A maximal connectedsubgraph.Tree A connected acyclic graph.Free tree A tree with no root.DAG Directed acyclic graph.Eulerian Graph with a trail visitingeach edge exactly once.Hamiltonian Graph with a cycle visitingeach vertex exactly once.Cut A set of edges whose removalincreases the numberof components.Cut-set A minimal cut.Cut edge A size 1 cut.k-Connected A graph connected withthe removal of any k − 1vertices.k-Tough ∀S ⊆ V,S ≠ ∅ we havek · c(G − S) ≤|S|.k-Regular A graph where all verticeshave degree k.k-Factor A k-regular spanningsubgraph.Matching A set of edges, no two ofwhich are adjacent.Clique A set of vertices, all ofwhich are adjacent.Ind. set A set of vertices, none ofwhich are adjacent.Vertex cover A set of vertices whichcover all edges.Planar graph A graph which can be embededin the plane.Plane graph An embedding of a planargraph.∑deg(v) =2m.v∈VIf G is planar then n − m + f =2,sof ≤ 2n − 4, m ≤ 3n − 6.Any planar graph has a vertex with degree≤ 5.Notation:E(G) Edge setV (G) Vertex setc(G) Number of componentsG[S] Induced subgraphdeg(v) Degree of v∆(G) Maximum degreeδ(G) Minimum degreeχ(G) Chromatic numberχ E (G) Edge chromatic numberG c Complement graphK n Complete graphK n1,n 2Complete bipartite graphr(k, l) Ramsey numberGeometryProjective coordinates: triples(x, y, z), not all x, y and z zero.(x, y, z) =(cx, cy, cz) ∀c ≠0.Cartesian Projective(x, y) (x, y, 1)y = mx + b (m, −1,b)x = c (1, 0, −c)Distance formula, L p and L ∞metric:√(x1 − x 0 ) 2 +(y 1 − y 0 ) 2 ,[|x1 − x 0 | p + |y 1 − y 0 | p] 1/p,[lim |x1 − x 0 | p + |y 1 − y 0 | p] 1/p.p→∞Area of triangle (x 0 ,y 0 ), (x 1 ,y 1 )and (x 2 ,y 2 ):∣ ∣1 ∣∣∣2 abs x 1 − x 0 y 1 − y 0 ∣∣∣.x 2 − x 0 y 2 − y 0Angle formed by three points:(x 2 ,y 2 )l 2θ(0, 0) l 1 (x 1 ,y 1 )cos θ = (x 1,y 1 ) · (x 2 ,y 2 ).l 1 l 2Line through two points (x 0 ,y 0 )and (x 1 ,y 1 ):x y 1x 0 y 0 1∣ x 1 y 1 1 ∣ =0.Area of circle, volume of sphere:A = πr 2 , V = 4 3 πr3 .If I have seen farther than others,it is because I have stood on theshoulders of giants.– Issac Newton