### Basic Modular Arithmetics

^{a}

*•* *Let m, n ∈ Z*^{+}.

*•* *m | n means m divides n; m is n’s divisor.*

*•* *We call the numbers 0, 1, . . . , n − 1 the residue modulo*
*n.*

*•* *The greatest common divisor of m and n is denoted*
*gcd(m, n).*

*•* *The r in Theorem 49 (p. 391) is a primitive root of p.*

*•* We now prove the existence of primitive roots and then
Theorem 49 (p. 391).

aCarl Friedrich Gauss.

### Basic Modular Arithmetics (concluded)

*•* We use

*a ≡ b mod n*
*if n | (a − b).*

– *So 25 ≡ 38 mod 13.*

*•* We use

*a = b mod n*

*if n | (a − b) and 0 ≤ b < n; in other words, b is the*
*remainder of a divided by n.*

– So 25 = 12 mod 13.

### Euler’s

^{a}

### Totient or Phi Function

*•* Let

*Φ(n) = {m : 1 ≤ m < n, gcd(m, n) = 1}*

*be the set of all positive integers less than n that are*
*prime to n.*^{b}

– *Φ(12) = {1, 5, 7, 11}.*

*•* *Define Euler’s function of n to be φ(n) = |Φ(n)|.*

*•* *φ(p) = p − 1 for prime p, and φ(1) = 1 by convention.*

*•* Euler’s function is not expected to be easy to compute
*without knowing n’s factorization.*

aLeonhard Euler (1707–1783).

b*Z*_{n}* ^{∗}* is an alternative notation.

Q

I+Q/

### HXOHUSKLQE

### Two Properties of Euler’s Function

The inclusion-exclusion principle^{a} can be used to prove the
following.

Lemma 52 *φ(n) = n* Q

*p|n**(1 −* ^{1}_{p}*).*

*•* *If n = p*^{e}_{1}^{1}*p*^{e}_{2}^{2} *· · · p*^{e}_{`}^{`}*is the prime factorization of n, then*
*φ(n) = n*

Y*`*
*i=1*

µ

*1 −* 1
*p*_{i}

¶
*.*

Corollary 53 *φ(mn) = φ(m) φ(n) if gcd(m, n) = 1.*

aConsult any textbook on discrete mathematics.

### A Key Lemma

Lemma 54 P

*m|n* *φ(m) = n.*

*•* Let Q_{`}

*i=1* *p*^{k}_{i}^{i}*be the prime factorization of n and consider*
Y*`*

*i=1*

*[ φ(1) + φ(p*_{i}*) + · · · + φ(p*^{k}_{i}^{i}*) ].* (4)

*•* *Equation (4) equals n because φ(p*^{k}_{i}*) = p*^{k}_{i}*− p*^{k−1}* _{i}* by
Lemma 52.

*•* Expand Eq. (4) to yield
X

*k*_{1}^{0}*≤k*1*,...,k*^{0}_{`}*≤k**`*

Y*`*
*i=1*

*φ(p*^{k}_{i}^{0}^{i}*).*

### The Proof (concluded)

*•* By Corollary 53 (p. 404),
Y*`*

*i=1*

*φ(p*^{k}_{i}^{0}^{i}*) = φ*

Ã * _{`}*
Y

*i=1*

*p*^{k}_{i}^{0}^{i}

!
*.*

*•* So Eq. (4) becomes

X

*k*_{1}^{0}*≤k*1*,...,k*_{`}^{0}*≤k**`*

*φ*

Ã * _{`}*
Y

*i=1*

*p*^{k}_{i}^{0}^{i}

!
*.*

*•* Each Q_{`}

*i=1* *p*^{k}_{i}^{0}^{i}*is a unique divisor of n =* Q_{`}

*i=1* *p*^{k}_{i}* ^{i}*.

*•* Equation (4) becomes

X*φ(m).*

### The Density Attack for primes

### Witnesses to compositeness

*of n*

*All numbers < n*

### The Density Attack for primes (continued)

1: *for i = 1, 2, . . . , N do*

2: *Choose 1 ≤ m ≤ n randomly;*

3: *if m | n then*

4: *return “n is not a prime”;*

5: end if

6: end for

7: *return “n is (probably) a prime”;*

### The Density Attack for primes (continued)

*•* It works, but does it work well?

*•* *The ratio of numbers ≤ n relatively prime to n (the*
*white area) is φ(n)/n.*

*•* *When n = pq, where p and q are distinct primes,*
*φ(n)*

*n* = *pq − p − q + 1*

*pq* *> 1 −* 1

*q* *−* 1
*p.*

### The Density Attack for primes (concluded)

*•* *So the ratio of numbers ≤ n not relatively prime to n*
*(the grey area) is < (1/q) + (1/p).*

– *The “density attack” has probability < 2/√*

*n of*
*factoring n = pq when p ∼ q = O(√*

*n ).*

– *The “density attack” to factor n = pq hence takes*
Ω(*√*

*n) steps on average when p ∼ q = O(√*
*n ).*

– This running time is exponential: Ω(2^{0.5 log}^{2}* ^{n}*).

### The Chinese Remainder Theorem

*•* *Let n = n*_{1}*n*_{2} *· · · n*_{k}*, where n** _{i}* are pairwise relatively
prime.

*•* *For any integers a*_{1}*, a*_{2}*, . . . , a** _{k}*, the set of simultaneous
equations

*x = a*_{1} *mod n*_{1}*,*
*x = a*_{2} *mod n*_{2}*,*

...

*x = a*_{k}*mod n*_{k}*,*

*has a unique solution modulo n for the unknown x.*

### Fermat’s “Little” Theorem

^{a}

Lemma 55 *For all 0 < a < p, a*^{p−1}*= 1 mod p.*

*•* *Consider aΦ(p) = {am mod p : m ∈ Φ(p)}.*

*•* *aΦ(p) = Φ(p).*

– *aΦ(p) ⊆ Φ(p) as a remainder must be between 0 and*
*p − 1.*

– *Suppose am = am*^{0}*mod p for m > m** ^{0}*, where

*m, m*

^{0}*∈ Φ(p).*

– *That means a(m − m*^{0}*) = 0 mod p, and p divides a or*
*m − m** ^{0}*, which is impossible.

aPierre de Fermat (1601–1665).

### The Proof (concluded)

*•* *Multiply all the numbers in Φ(p) to yield (p − 1)!.*

*•* *Multiply all the numbers in aΦ(p) to yield a*^{p−1}*(p − 1)!.*

*•* *As aΦ(p) = Φ(p), a*^{p−1}*(p − 1)! = (p − 1)! mod p.*

*•* *Finally, a*^{p−1}*= 1 mod p because p 6 |(p − 1)!.*

### The Fermat-Euler Theorem

^{a}

Corollary 56 *For all a ∈ Φ(n), a*^{φ(n)}*= 1 mod n.*

*•* The proof is similar to that of Lemma 55 (p. 412).

*•* *Consider aΦ(n) = {am mod n : m ∈ Φ(n)}.*

*•* *aΦ(n) = Φ(n).*

– *aΦ(n) ⊆ Φ(n) as a remainder must be between 0 and*
*n − 1 and relatively prime to n.*

– *Suppose am = am*^{0}*mod n for m*^{0}*< m < n, where*
*m, m*^{0}*∈ Φ(n).*

– *That means a(m − m*^{0}*) = 0 mod n, and n divides a or*
*m − m** ^{0}*, which is impossible.

aProof by Mr. Wei-Cheng Cheng (R93922108, D95922011) on Novem- ber 24, 2004.

### The Proof (concluded)

^{a}

*•* *Multiply all the numbers in Φ(n) to yield* Q

*m∈Φ(n)* *m.*

*•* *Multiply all the numbers in aΦ(n) to yield*
*a** ^{φ(n)}* Q

*m∈Φ(n)* *m.*

*•* *As aΦ(n) = Φ(n),*
Y

*m∈Φ(n)*

*m = a*^{φ(n)}

Y

*m∈Φ(n)*

*m*

* mod n.*

*•* *Finally, a*^{φ(n)}*= 1 mod n because n 6 |* Q

*m∈Φ(n)* *m.*

aSome typographical errors corrected by Mr. Jung-Ying Chen (D95723006) on November 18, 2008.

### An Example

*•* As 12 = 2^{2} *× 3,*

*φ(12) = 12 ×*
µ

*1 −* 1
2

¶ µ

*1 −* 1
3

¶

*= 4.*

*•* *In fact, Φ(12) = {1, 5, 7, 11}.*

*•* For example,

5^{4} *= 625 = 1 mod 12.*

### Exponents

*•* *The exponent of m ∈ Φ(p) is the least k ∈ Z*^{+} such that
*m*^{k}*= 1 mod p.*

*•* *Every residue s ∈ Φ(p) has an exponent.*

– *1, s, s*^{2}*, s*^{3}*, . . . eventually repeats itself modulo p, say*
*s*^{i}*= s*^{j}*mod p, which means s*^{j−i}*= 1 mod p.*

*•* *If the exponent of m is k and m*^{`}*= 1 mod p, then k|`.*

– *Otherwise, ` = qk + a for 0 < a < k, and*

*m*^{`}*= m*^{qk+a}*= m*^{a}*= 1 mod p, a contradiction.*

Lemma 57 *Any nonzero polynomial of degree k has at most*
*k distinct roots modulo p.*

### Exponents and Primitive Roots

*•* From Fermat’s “little” theorem, all exponents divide
*p − 1.*

*•* *A primitive root of p is thus a number with exponent*
*p − 1.*

*•* *Let R(k) denote the total number of residues in Φ(p)*
*that have exponent k.*

*•* *We already knew that R(k) = 0 for k 6 |(p − 1).*

*•* So X

*k|(p−1)*

*R(k) = p − 1*
as every number has an exponent.

*Size of R(k)*

*•* *Any a ∈ Φ(p) of exponent k satisfies*
*x*^{k}*= 1 mod p.*

*•* *Hence there are at most k residues of exponent k, i.e.,*
*R(k) ≤ k, by Lemma 57 (p. 417).*

*•* *Let s be a residue of exponent k.*

*•* *1, s, s*^{2}*, . . . , s*^{k−1}*are distinct modulo p.*

– *Otherwise, s*^{i}*= s*^{j}*mod p with i < j.*

– *Then s*^{j−i}*= 1 mod p with j − i < k, a contradiction.*

*•* *As all these k distinct numbers satisfy x*^{k}*= 1 mod p,*
*they comprise all solutions of x*^{k}*= 1 mod p.*

*Size of R(k) (continued)*

*•* *But do all of them have exponent k (i.e., R(k) = k)?*

*•* *And if not (i.e., R(k) < k), how many of them do?*

*•* *Suppose ` < k and ` 6∈ Φ(k) with gcd(`, k) = d > 1.*

*•* Then

*(s** ^{`}*)

^{k/d}*= (s*

*)*

^{k}

^{`/d}*= 1 mod p.*

*•* *Therefore, s*^{`}*has exponent at most k/d, which is less*
*than k.*

*•* We conclude that

*R(k) ≤ φ(k).*

*Size of R(k) (concluded)*

*•* *Because all p − 1 residues have an exponent,*
*p − 1 =* X

*k|(p−1)*

*R(k) ≤* X

*k|(p−1)*

*φ(k) = p − 1*

by Lemma 54 (p. 405).

*•* Hence

*R(k) =*

*φ(k) when k|(p − 1)*
0 otherwise

*•* *In particular, R(p − 1) = φ(p − 1) > 0, and p has at least*
one primitive root.

*•* This proves one direction of Theorem 49 (p. 391).

### A Few Calculations

*•* *Let p = 13.*

*•* *From p. 414, we know φ(p − 1) = 4.*

*•* *Hence R(12) = 4.*

*•* *Indeed, there are 4 primitive roots of p.*

*•* As

*Φ(p − 1) = {1, 5, 7, 11},*
the primitive roots are

*g*^{1}*, g*^{5}*, g*^{7}*, g*^{11}
*for any primitive root g.*

### The Other Direction of Theorem 49 (p. 391)

*•* *We show p is a prime if there is a number r such that*
1. *r*^{p−1}*= 1 mod p, and*

2. *r*^{(p−1)/q}*6= 1 mod p for all prime divisors q of p − 1.*

*•* *Suppose p is not a prime.*

*•* We proceed to show that no primitive roots exist.

*•* *Suppose r*^{p−1}*= 1 mod p (note gcd(r, p) = 1).*

*•* We will show that the 2nd condition must be violated.

### The Proof (continued)

*•* *So we proceed to show r*^{(p−1)/q}*= 1 mod p for some*
*prime divisor q of p − 1.*

*•* *r*^{φ(p)}*= 1 mod p by the Fermat-Euler theorem (p. 414).*

*•* *Because p is not a prime, φ(p) < p − 1.*

*•* *Let k be the smallest integer such that r*^{k}*= 1 mod p.*

*•* *With the 1st condition, it is easy to show that k | (p − 1)*
(similar to p. 417).

*•* *Note that k | φ(p) (p. 417).*

*•* *As k ≤ φ(p), k < p − 1.*

### The Proof (concluded)

*•* *Let q be a prime divisor of (p − 1)/k > 1.*

*•* *Then k|(p − 1)/q.*

*•* *By the definition of k,*

*r*^{(p−1)/q}*= 1 mod p.*

*•* But this violates the 2nd condition.

### Function Problems

*•* Decision problems are yes/no problems (sat, tsp (d),
etc.).

*•* Function problems require a solution (a satisfying
truth assignment, a best tsp tour, etc.).

*•* Optimization problems are clearly function problems.

*•* What is the relation between function and decision
problems?

*•* Which one is harder?

### Function Problems Cannot Be Easier than Decision Problems

*•* If we know how to generate a solution, we can solve the
corresponding decision problem.

– If you can find a satisfying truth assignment efficiently, then sat is in P.

– If you can find the best tsp tour efficiently, then tsp (d) is in P.

*•* But decision problems can be as hard as the
corresponding function problems.

### fsat

*•* fsat is this function problem:

– *Let φ(x*_{1}*, x*_{2}*, . . . , x** _{n}*) be a boolean expression.

– *If φ is satisfiable, then return a satisfying truth*
assignment.

– Otherwise, return “no.”

*•* *We next show that if sat ∈ P, then fsat has a*
polynomial-time algorithm.

### An Algorithm for fsat Using sat

1: *t := ²; {Truth assignment.}*

2: *if φ ∈ sat then*

3: *for i = 1, 2, . . . , n do*

4: *if φ[ x*_{i}*= true ] ∈ sat then*
5: *t := t ∪ { x*_{i}*= true };*

6: *φ := φ[ x** _{i}* = true ];

7: else

8: *t := t ∪ { x*_{i}*= false };*

9: *φ := φ[ x** _{i}* = false ];

10: end if
11: end for
12: *return t;*

13: else

14: return “no”;

15: end if

### Analysis

*•* If sat can be solved in polynomial time, so can fsat.

– *There are ≤ n + 1 calls to the algorithm for sat.*^{a}
– *Boolean expressions shorter than φ are used in each*

call to the algorithm for sat.

*•* Hence sat and fsat are equally hard (or easy).

*•* Note that this reduction from fsat to sat is not a Karp
reduction (recall p. 219).

*•* Instead, it calls sat multiple times as a subroutine and
moves on sat’s outputs.

aContributed by Ms. Eva Ou (R93922132) on November 24, 2004.

### tsp and tsp (d) Revisited

*•* *We are given n cities 1, 2, . . . , n and integer distances*
*d*_{ij}*= d*_{ji}*between any two cities i and j.*

*•* tsp (d) asks if there is a tour with a total distance at
*most B.*

*•* tsp asks for a tour with the shortest total distance.

– The shortest total distance is at most P

*i,j* *d** _{ij}*.

*∗* *Recall that the input string contains d*_{11}*, . . . , d** _{nn}*.

*∗* Thus the shortest total distance is less than 2* ^{| x |}* in

*magnitude, where x is the input (why?).*

*•* *We next show that if tsp (d) ∈ P, then tsp has a*
polynomial-time algorithm.

### An Algorithm for tsp Using tsp (d)

1: *Perform a binary search over interval [ 0, 2** ^{| x |}* ] by calling

*tsp (d) to obtain the shortest distance, C;*

2: *for i, j = 1, 2, . . . , n do*

3: *Call tsp (d) with B = C and d*_{ij}*= C + 1;*

4: if “no” then

5: *Restore d*_{ij}*to old value; {Edge [ i, j ] is critical.}*

6: end if

7: end for

8: *return the tour with edges whose d*_{ij}*≤ C;*

### Analysis

*•* *An edge that is not on any optimal tour will be*
*eliminated, with its d*_{ij}*set to C + 1.*

*•* *An edge which is not on all remaining optimal tours will*
also be eliminated.

*•* *So the algorithm ends with n edges which are not*
eliminated (why?).

*•* *There are O(| x | + n*^{2}) calls to the algorithm for tsp (d).

*•* So if tsp (d) can be solved in polynomial time, so can
tsp.

*•* Hence tsp (d) and tsp are equally hard (or easy).

*Randomized Computation*

I know that half my advertising works, I just don’t know which half.

— John Wanamaker I know that half my advertising is a waste of money, I just don’t know which half!

— McGraw-Hill ad.

### Randomized Algorithms

^{a}

*•* Randomized algorithms flip unbiased coins.

*•* There are important problems for which there are no
*known efficient deterministic algorithms but for which*
very efficient randomized algorithms exist.

– Extraction of square roots, for instance.

*•* *There are problems where randomization is necessary.*

– Secure protocols.

*•* Randomized version can be more efficient.

– Parallel algorithm for maximal independent set.

aRabin (1976); Solovay and Strassen (1977).

### “Four Most Important Randomized Algorithms”

^{a}

1. Primality testing.^{b}

2. Graph connectivity using random walks.^{c}
3. Polynomial identity testing.^{d}

4. Algorithms for approximate counting.^{e}

aTrevisan (2006).

bRabin (1976); Solovay and Strassen (1977).

cAleliunas, Karp, Lipton, Lov´asz, and Rackoff (1979).

dSchwartz (1980); Zippel (1979).

eSinclair and Jerrum (1989).

### Bipartite Perfect Matching

*•* *We are given a bipartite graph G = (U, V, E).*

– *U = {u*_{1}*, u*_{2}*, . . . , u*_{n}*}.*

– *V = {v*_{1}*, v*_{2}*, . . . , v*_{n}*}.*

– *E ⊆ U × V .*

*•* We are asked if there is a perfect matching.

– *A permutation π of {1, 2, . . . , n} such that*
*(u*_{i}*, v*_{π(i)}*) ∈ E*

*for all i ∈ {1, 2, . . . , n}.*

### A Perfect Matching

X_{}

X_{}

X_{}

X_{}

X_{}

Y_{}

Y_{}

Y_{}

Y_{}

Y_{}

### Symbolic Determinants

*•* *We are given a bipartite graph G.*

*•* *Construct the n × n matrix A*^{G}*whose (i, j)th entry A*^{G}_{ij}*is a variable x*_{ij}*if (u*_{i}*, v*_{j}*) ∈ E and zero otherwise.*

### Symbolic Determinants (concluded)

*•* *The determinant of A** ^{G}* is

*det(A*

*) = X*

^{G}*π*

*sgn(π)*
Y*n*
*i=1*

*A*^{G}_{i,π(i)}*.* (5)
– *π ranges over all permutations of n elements.*

– *sgn(π) is 1 if π is the product of an even number of*
*transpositions and −1 otherwise.*

– *Equivalently, sgn(π) = 1 if the number of (i, j)s such*
*that i < j and π(i) > π(j) is even.*^{a}

aContributed by Mr. Hwan-Jeu Yu (D95922028) on May 1, 2008.

### Determinant and Bipartite Perfect Matching

*•* In P

*π* *sgn(π)*Q_{n}

*i=1* *A*^{G}* _{i,π(i)}*, note the following:

– Each summand corresponds to a possible perfect
*matching π.*

– All of these summands Q_{n}

*i=1* *A*^{G}* _{i,π(i)}* are different
monomials and will not cancel.

*•* It is essentially an exhaustive enumeration.

Proposition 58 (Edmonds (1967)) *G has a perfect*
*matching if and only if det(A*^{G}*) is not identically zero.*

### A Perfect Matching in a Bipartite Graph

X_{}

X_{}

X_{}

X_{}

X_{}

Y_{}

Y_{}

Y_{}

Y_{}

Y_{}

### The Perfect Matching in the Determinant

*•* The matrix is

*A** ^{G}* =

0 0 *x*_{13} *x*_{14} 0

0 *x*_{22} 0 0 0

*x*_{31} 0 0 0 *x*_{35}

*x*_{41} 0 *x*_{43} *x*_{44} 0

*x*_{51} 0 0 0 *x*_{55}

*.*

*•* *det(A*^{G}*) = −x*_{14}*x*_{22}*x*_{35}*x*_{43}*x*_{51} *+ x*_{13}*x*_{22}*x*_{35}*x*_{44}*x*_{51} +
*x*_{14}*x*_{22}*x*_{31}*x*_{43}*x*_{55} *− x*_{13}*x*_{22}*x*_{31}*x*_{44}*x*_{55}, each denoting a
perfect matching.

### How To Test If a Polynomial Is Identically Zero?

*•* *det(A*^{G}*) is a polynomial in n*^{2} variables.

*•* *There are exponentially many terms in det(A** ^{G}*).

*•* Expanding the determinant polynomial is not feasible.

– Too many terms.

*•* *Observation: If det(A*^{G}*) is identically zero, then it*

*remains zero if we substitute arbitrary integers for the*
*variables x*_{11}*, . . . , x** _{nn}*.

*•* But what is the likelihood of obtaining a zero when
*det(A*^{G}*) is not identically zero?*

### Number of Roots of a Polynomial

Lemma 59 (Schwartz (1980)) *Let p(x*_{1}*, x*_{2}*, . . . , x*_{m}*) 6≡ 0*
*be a polynomial in m variables each of degree at most d. Let*
*M ∈ Z*^{+}*. Then the number of m-tuples*

*(x*_{1}*, x*_{2}*, . . . , x*_{m}*) ∈ {0, 1, . . . , M − 1}*^{m}*such that p(x*_{1}*, x*_{2}*, . . . , x*_{m}*) = 0 is*

*≤ mdM*^{m−1}*.*

*•* *By induction on m (consult the textbook).*

### Density Attack

*•* The density of roots in the domain is at most
*mdM*^{m−1}

*M** ^{m}* =

*md*

*M* *.* (6)

*•* *So suppose p(x*_{1}*, x*_{2}*, . . . , x*_{m}*) 6≡ 0.*

*•* Then a random

*(x*_{1}*, x*_{2}*, . . . , x*_{m}*) ∈ { 0, 1, . . . , M − 1 }*^{m}*has a probability of ≤ md/M of being a root of p.*

*•* *Note that M is under our control.*

*•* *One can raise M to lower the error probability, e.g.*

### Density Attack (concluded)

*Here is a sampling algorithm to test if p(x*_{1}*, x*_{2}*, . . . , x*_{m}*) 6≡ 0.*

1: *Choose i*_{1}*, . . . , i*_{m}*from {0, 1, . . . , M − 1} randomly;*

2: *if p(i*_{1}*, i*_{2}*, . . . , i*_{m}*) 6= 0 then*

3: *return “p is not identically zero”;*

4: else

5: *return “p is (probably) identically zero”;*

6: end if

### A Randomized Bipartite Perfect Matching Algorithm

^{a}

We now return to the original problem of bipartite perfect matching.

1: *Choose n*^{2} *integers i*_{11}*, . . . , i*_{nn}*from {0, 1, . . . , 2n*^{2} *− 1}*

randomly;

2: *Calculate det(A*^{G}*(i*_{11}*, . . . , i** _{nn}*)) by Gaussian elimination;

3: *if det(A*^{G}*(i*_{11}*, . . . , i*_{nn}*)) 6= 0 then*

4: *return “G has a perfect matching”;*

5: else

6: *return “G has no perfect matchings”;*

7: end if

aLov´asz (1979). According to Paul Erd˝os, Lov´asz wrote his first sig- nificant paper “at the ripe old age of 17.”

### Analysis

*•* *If G has no perfect matchings, the algorithm will always*
be correct.

*•* *Suppose G has a perfect matching.*

– The algorithm will answer incorrectly with

*probability at most n*^{2}*d/(2n*^{2}*) = 0.5 with d = 1 in*
Eq. (6) on p. 447.

– *Run the algorithm independently k times and output*

*“G has no perfect matchings” if and only if they all*
say no.

– The error probability is now reduced to at most 2* ^{−k}*.

### L´oszl´o Lov´asz (1948–)

### Remarks

^{a}

*•* Note that we are calculating

*prob[ algorithm answers “no” | G has no perfect matchings ],*
*prob[ algorithm answers “yes” | G has a perfect matching ].*

*•* *We are not calculating*^{b}

*prob[ G has no perfect matchings | algorithm answers “no” ],*
*prob[ G has a perfect matching | algorithm answers “yes” ].*

aThanks to a lively class discussion on May 1, 2008.

b*Numerical Recipes in C (1988), “[As] we already remarked, statistics*
*is not a branch of mathematics!”*

*But How Large Can det(A*

^{G}*(i*

_{11}

*, . . . , i*

_{nn}### )) Be?

*•* It is at most

*n!* ¡

*2n*^{2}¢_{n}*.*

*•* *Stirling’s formula says n! ∼* *√*

*2πn (n/e)** ^{n}*.

*•* Hence

log_{2} *det(A*^{G}*(i*_{11}*, . . . , i*_{nn}*)) = O(n log*_{2} *n)*
bits are sufficient for representing the determinant.

*•* We skip the details about how to make sure that all
intermediate results are of polynomial sizes.

### An Intriguing Question

^{a}

*•* *Is there an (i*_{11}*, . . . , i** _{nn}*) that will always give correct
answers for the algorithm on p. 449?

*•* A theorem on p. 544 shows that such a witness exists!

*•* Whether it can be found efficiently is another question.

aThanks to a lively class discussion on November 24, 2004.

### Perfect Matching for General Graphs

*•* Page 438 is about bipartite perfect matching

*•* *Now we are given a graph G = (V, E).*

– *V = {v*_{1}*, v*_{2}*, . . . , v*_{2n}*}.*

*•* We are asked if there is a perfect matching.

– *A permutation π of {1, 2, . . . , 2n} such that*
*(v*_{i}*, v*_{π(i)}*) ∈ E*

*for all v*_{i}*∈ V .*

### The Tutte Matrix

^{a}

*•* *Given a graph G = (V, E), construct the 2n × 2n Tutte*
*matrix T** ^{G}* such that

*T*_{ij}* ^{G}* =

*x*_{ij}*if (v*_{i}*, v*_{j}*) ∈ E and i < j,*

*−x*_{ij}*if (v*_{i}*, v*_{j}*) ∈ E and i > j,*
0 *othersie.*

*•* The Tutte matrix is a skew-symmetric symbolic matrix.

*•* Similar to Proposition 58 (p. 442):

Proposition 60 *G has a perfect matching if and only if*
*det(T*^{G}*) is not identically zero.*

aWilliam Thomas Tutte (1917–2002).