• No se han encontrado resultados

FORMATOS DE IMAGEN PARA EL DIAGNÓSTICO Análisis de la huella plantar

1.3 CONOCIMIENTO DEL PIE PLANO INFANTIL

1.3.3 FORMATOS DE IMAGEN PARA EL DIAGNÓSTICO Análisis de la huella plantar

Let f(x1, . . . , xn) be a rational polynomial with n variables that has degree at most k in

each of its variables. We would like to decide whether f is identically 0 (as a function of n

variables). We know from classical algebra that a polynomial is identically 0 if and only if, after “opening its parentheses”, all terms “cancel”. This criterion is, however, not always useful. It is conceivable, e.g., that the polynomial is given in a parenthesized form an the

opening of the parentheses leads to exponentially many terms as in (x1+y1)(x2+y2)· · ·(xn+yn) + 1.

It would also be good to say something about polynomials in whose definition not only the basic algebraic operations occur but also some other ones, like the computation of a determinant (which is a polynomial itself but is often computed, as we have seen, in some special way).

The basic idea is that we write random numbers in place of the variables and compute the value of the polynomial. If this is not 0 then, naturally, the polynomial cannot be identically 0. If the computed value is 0 then though it can happen that the polynomial is not identically 0, but “hitting” one of its roots has very small probability; therefore in this case we can conclude that the polynomial is identically 0; the probability that we make a mistake is small.

If we could give real values to the variables, chosen according to the uniform distribution e.g. in the interval [0,1], then the probability of error would be 0. We must in reality, however, compute with discrete values; therefore we assume that the values of the variables are chosen from among the integers of the interval [0, N−1], independently and according to the uniform distribution. In this case, the probability of error will not be 0 but it will be “small” ifN is large enough. This is the meaning of the following fundamental result:

Theorem 7.2.1 Schwartz’s Lemma If f is a not identically 0 polynomial in n variables with degree at most k, and the values ξi (i= 1, . . . , n) are chosen in the interval[0, N−1]

independently of each other according to the uniform distribution then

P{f(ξ1, . . . , ξn) = 0} ≤

k N.

(The degree of a polynomial in several variables is defined as the largest degree of its terms (monomials); the degree of a monomial is the sum of the exponents of the variables in it.) Proof. We prove the assertion by induction onn. The statement is true forn= 1 since a polynomial in one variable of degree k can have at most k roots. Let n > 1 and let us arrangef according to the powers ofx1:

f =f0+f1x1+f2x21+· · ·+ftxt1,

7.2. VERIFYING A POLYNOMIAL IDENTITY 123 andt≤k. Now, P{f(ξ1, . . . , ξn) = 0} P{f(ξ1, . . . , ξn) = 0|ft(ξ2, . . . , ξn) = 0}P{ft(ξ2, . . . , ξn) = 0} +P{f(ξ1, . . . , ξn) = 0|ft(ξ2, . . . , ξn)6= 0}P{ft(ξ2, . . . , ξn)6= 0} P{ft(ξ2, . . . , ξn) = 0}+P{f(ξ1, . . . , ξn) = 0|ft(ξ2, . . . , ξn)6= 0}.

Here can estimate the first term by the induction hypothesis, using that the degree of ft is

at most k−t; thus the first term is at most (k−t)/N. The second term is at most t/N

(since ξ1 is independent of the variables ξ2, . . . , ξn, therefore no matter how the latter are

fixed in such a way that ft6= 0 ( and thereforef as a polynomial ofx1 is not identically 0),

the probability thatξ1 is its root is at mostt/N). Hence

P{f(ξ1, . . . , ξn) = 0} ≤ k−t N + t N k N. ¤ This suggests the following arandomized algorithm to decide whether a polynomialf is identically 0:

Algorithm 7.2.2 We compute f(ξ1, . . . , ξn) with integer values ξi chosen randomly and

independently of each other according to the uniform distribution in the interval [0,2kn]. If we don’t get the value 0 we stop: f is not identically 0. If we get 0 value we repeat the computation. If we get 0 value 100 times we stop and declare thatf is identically 0.

If f is identically 0 then this algorithm will determine this. If f is not identically 0 then in every separate iteration—according to Schwartz’s Lemma—the probability that the result is 0 is less than 1/2. With 100 experiments repeated independently of each other, the probability that this occurs every time, i.e., that the algorithm asserts erroneously thatf is identically 0, is less than 2100.

Two things are needed for us to be able to actually carry out this algorithm: on the one hand, we must be able to generate random numbers (here, we assume that this can be imple- mented, and even in time polynomial in the number of bits of the integers to be generated), on the other hand, we must be able to evaluatef in polynomial time (the size of the input is the length of the “definition” of f; this definition can be, e.g., an expression containing multiplications and additions with parentheses, but also something entirely different, e.g., a determinant form).

As a surprising example for the application of the method we present a matching al- gorithm. (We have already treated the matching problem in Chapters 3 and 5). Let

G be a bipartite graph with the edge set E(G) whose edges run between sets A and B,

A ={a1, . . . , an}, B ={b1, . . . , bn}. Let us assign to each edge aibj a variable xij. Let us

construct then×nmatrixM as follows:

mij =

(

xij, ifaibj ∈E(G),

0, otherwise.

The determinant of this graph is closely connected with the matchings of the graph G as D´enes K˝onig noticed while analyzing a work of Frobenius:

Theorem 7.2.3 There is a perfect matching in the bipartite graphGif and only if det(M) is not identically 0.

Proof. Consider a term in the expansion of the determinant: ±m1π(1)m2π(2)· · ·mnπ(n),

whereπis a permutation of the numbers 1, . . . , n. For this not to be 0, we need thataiand

(i)be connected for alli; in other words, that{a1(1), . . . , anbπ(n)} be a perfect matching

in G. In this way, if there is no perfect matching in G then the determinant is identically 0. If there are perfect matchings in Gthen to each one of them a nonzero expansion term corresponds. Since these terms do not cancel each other (any two of them contain at least two different variables), the determinant is not identically 0. ¤ Since det(M) is a polynomial of the elements of the matrix M that is computable in polynomial time (e.g. by Gaussian elimination) this theorem offers a polynomial-time ran- domized algorithm for the matching problem in bipartite graphs. We mentioned it before that there is also a polynomial-time deterministic algorithm for this problem (the “Hungarian method”). One advantage of the algorithm treated here is that it is very easy to program (determinant-computation can generally be found in the program library). If we use “fast” matrix multiplication methods then this randomized algorithm is a little faster than the fastest known deterministic one: it can be completed in timeO(n2.4) instead ofO(n2.5). Its

main advantage is, however, that it is well suitable to parallelization, as we will see in a later section.

In non-bipartite graphs, it can also be decided by a similar but slightly more complicated method whether there is a perfect matching. LetV ={v1, . . . , vn} be the vertex set of the

graph G. Assign again to each edge vivj (where i < j) a variable xij and construct an

asymmetricn×nmatrixT = (tij) as follows:

tij=      xij, ifvivj ∈E(G) andi < j, −xij, ifvivj ∈E(G) andi > j, 0, otherwise.

7.2. VERIFYING A POLYNOMIAL IDENTITY 125 The following analogue of the above cited Frobenius-K˝onig theorem comes from Tutte and we formulate it here without proof:

Theorem 7.2.4 There is a perfect matching in the graph G if and only if det(T) is not identically 0.

This theorem offers, similarly to the case of the bipartite graph, a randomized algorithm for deciding whether there is a perfect matching in G.