On Conditional Probabilities of Factoring Quadratics

Abstract

Factoring quadratics over Z is a staple of introductory algebra and textbooks tend to create the impression that doable factorizations are fairly common. To the contrary, if coefficients of a general quadratic are selected randomly without restriction, the probability that a factorization exists is zero. We achieve a specific quantification of the probability of factoring quadratics by taking a new approach that considers the absolute size of coefficients to be a parameter n. This restriction allows us to make relative likelihood estimates based on finite sample spaces. Our probability estimates are then conditioned on the size parameter n and the behavior of the conditional estimates may be studied as the parameter is varied. Specifically, we enumerate how many formal factored expressions could possibly correspond to a quadratic for a given size parameter. The conditional probability of factorization as a function of n is just the ratio of this enumeration to the total number of possible quadratics consistent with n. This approach is patterned after the well-known case where factorizations are carried out over a finite field. We review the finite field method as background for our method of dealing with Z [x]. The monic case is developed independently of the general case because it is simpler and the resulting probability estimating formula is more accurate. We conclude with a comparison of our theoretical probability estimates with exact data generated by a computer search for factorable quadratics corresponding to various parameter values.

Share and Cite:

Beatty, T. and Linden, G. (2020) On Conditional Probabilities of Factoring Quadratics. Advances in Pure Mathematics, 10, 114-124. doi: 10.4236/apm.2020.103008.

1. Introduction

This paper presents the preliminary results of a broader program to estimate the probabilities of factoring more general polynomials over . We anticipate that subsequent research will develop along the lines suggested by the quadratic case investigated here, specifically by using the method of parameterizing the maximum absolute value of coefficients and correlating the conditional probabilities of factorization with the size of the parameter.

The probability that a given general quadratic α x 2 + β x + γ [ x ] can be factored depends heavily on the commensurability of the coefficients [1] [2] [3]. Loosely speaking, if the coefficients are all about the same size in absolute value, and that size is small, the existence of a factorization is relatively more likely than otherwise. Our intention is to quantify this phenomenon. Dealing with the infinite number of choices available for coefficients is a problem. We sidestep this obstacle by adapting the method used to determine the probability of factorization of quadratics over finite fields. Briefly, we establish a cutoff, or size parameter n, for the absolute value of any coefficients appearing in any of the quadratics we wish to study. This makes the number of quadratics under consideration finite as well as the number of formal factored expressions that could possibly yield such a quadratic. Then the classical probability is just the ratio of the number of admissible factored expressions to the total number of quadratics which conform to the cutoff. This probability P ( n ) is, of course, a conditional probability given that the coefficients do not exceed n in absolute value. So the infinite character of the problem is initially made finitary where calculations can be done and then can be recovered by allowing n to approach infinity.

We consider three cases, the first of which, factoring quadratics over finite fields, is well-known [4]. For factoring quadratics over , we split the discussion into two parts: 1) the monic case, and 2) the general case. For simplicity we consider quadratics in [ x ] that have non-negative roots.

Figure 1 shows factorization probabilities calculated by the computer search. Currently we have no formula that estimates the case a x 2 + b x + c [ x ] with α 0 other than curve fitting. The trend in the graph in Figure 1 is borne out by the following proposition.

Proposition 0

If a , b , c are selected randomly without restriction, then the probability of factoring a x 2 + b x + c over is zero.

Proof. Suppose we are given a x 2 + b x + c with a , b , c selected at random. This quadratic factors over , hence by Gauss’ Lemma, if the discriminant Δ = b 2 4 a c is a perfect square. We ask what is the probability that Δ is a perfect square if a and b have been selected and c is provisionally allowed to range over [ n , n ] for some n . Then there are 2 n + 1 possible values of Δ spread over an interval of length | 8 a n | . The largest possible number of perfect squares in such an interval would occur when none of the interval intersected the open left half line and where the arithmetic density of squares was the greatest. This would occur if the interval were exactly [ 0, | 8 a n | ] . The number of squares in this interval does not exceed | 8 a n | . The classical probability that

Figure 1. P ( n ) is the probability of factoring a x 2 + b x + c with | a | , | b | , | c | n .

one of these squares coincides with a value of Δ is therefore no more than | 8 a n | 2 n + 1 < 2 | a | 1 n . As the provisional restriction that c [ n , n ] is relaxed by allowing n , we see 2 | a | 1 n 0 . It follows that the probability that Δ is a perfect square, and therefore a x 2 + b x + c is factorable over , is zero in the limit, which corresponds to no restrictions at all on c. Since this is true for any triple ( a , b , c ) , the proposition is established.

We wish to have a more granular understanding of the way in which factorability depends on commensurability of coefficients. Our approach to this question is motivated by solving the factorization probability problem in the context of finite fields, which we review below.

2. Factoring Over G F (pn)

Suppose we are given a random monic quadratic over the finite field G F ( p ) . What is the likelihood that it factors [5] ?

2.1. Proposition 1

If f ( x ) = x 2 + α x + β and α , β G F ( p ) , then the probability P p of factoring f ( x ) over G F ( p ) is 1 2 + 1 2 p .

Proof. There are p 2 possible pairs of coefficients, hence p 2 distinct quadratics. On the other hand, if f factors as ( x r 1 ) ( x r 2 ) , then there are p factorizations where r 1 = r 2 and ( p 2 ) distinct factorizations where r 1 r 2 , allowing for interchanging the factors. P p is the ratio of possible factorizations to possible quadratics, so P p = p + p ( p 1 ) 2 p 2 = 1 2 + 1 2 p .

Now let us generalize to an arbitrary quadratic.

2.2. Corollary 1-1

If f ( x ) = λ x 2 + α x + β and λ ( 0 ) , α , β G F ( p ) , then the probability P p of factoring f ( x ) over G F ( p ) is 1 2 + 1 2 p .

Proof. Evidently there are ( p 1 ) p 2 possible triples of coefficients, but we can mimic the above proof by rewriting f ( x ) = λ ( x 2 + λ 1 α x + λ 1 β ) = λ ( x 2 + α x + β ) . Now the possible factorizations would look like λ ( x r 1 ) ( x r 2 ) . Once again, the probability of factoring a random quadratic, not necessarily monic, would be P p = ( p 1 ) ( p 2 + p 2 ) ( p 1 ) p 2 = 1 2 + 1 2 p .

2.3. Corollary 1-2

If f ( x ) = λ x 2 + α x + β and λ ( 0 ) , α , β G F ( p n ) , then the probability P p n of factoring f ( x ) over G F ( p n ) is 1 2 + 1 2 p n .

Proof. Following the proof for the preceding, we have ( p n 1 ) p 2 n possible triples of coefficients, and ( p n 1 ) [ p n + p n ( p n 1 ) 2 ] = ( p n 1 ) ( p 2 n + p n 2 ) possible factorizations. Hence P p n = ( p n 1 ) ( p 2 n + p n 2 ) ( p n 1 ) p 2 n = 1 2 + 1 2 p n .

2.4. Corollary 1-3

The limit as p of the probability P p n of factoring a quadratic over G F ( p n ) is 1 2 .

Proof. This follows immediately from the fact that the limit as p of the expression in Corollary 1-2 is independent of n.

The situation we see embodied in Proposition 1 and its corollaries is somewhat unexpected (at least the first time it is considered) and in any case very different from factoring over . It is a mildly entertaining exercise in experimental mathematics to choose a large prime p and ask a computer algebra system to factor several random quadratics with large coefficients modulo p. Superficially, since p is large, it seems that the chances for a factorization would be about the same as if the factorization were to be done over , namely poor. But in the long run, about half of the test examples result in factorizations. Although it would defeat the whole purpose of our discussion of the enumeration method for factorization probabilities in the finite field case, a short proof of Proposition 1 can be gotten directly from number theory. The quadratic equation x 2 + α x + β = 0 can be simplified by completing the square, leaving a constant on the right hand side. Among the p 1 non-zero least residues modulo p,exactly p 1 2 are quadratic residues. The constant needs to be a quadratic residue so that roots can be found to construct a factorization. Zero is always a quadratic residue, so there are p 1 2 + 1 = p + 1 2 quadratic residues in all. On the other hand, there are p least residues modulo p, hence the probability that a randomly chosen least residue is in fact a quadratic residue is p + 1 2 p = 1 2 + 1 2 p as above.

3. Factoring Over -Monic Case

We would like to adapt the same argument for factoring over as we used for finite fields, namely counting up the number of possible distinct factorizations and dividing by the number of distinct quadratic expressions to get a probability of being able to factor. Since is infinite this plan is immediately hobbled [6]. Consider the polynomial x 2 + a x + 1 , where α is random. There are only two hopes for factorization: α = ± 2 . Yet there are infinitely many choices for α , so the probability of factorization is evidently zero. To salvage any insight from this state of affairs, we have to content ourselves with a conditional probability based on limiting how “random” a random quadratic can be. A reasonable choice is to insist that its coefficients be commensurable with its possible zeroes. Clearly x 2 + 37 x + 1 does not have this property, which is informal at the moment, but which will soon be made precise. On the other hand, both x 2 + x + 1 and x 2 + 2 x + 1 seem to have it. In one case there is a factorization, in the other not. This conditional probability will be based on a relative likelihood calculation where the commensurability condition is quantified by a parameter. As the parameter increases, the commensurability decreases, and the probability of factorization will tend to zero. The point of our approach is to model the detailed behavior of this process. To introduce the specifics in a simple context, we first consider monic quadratics with the restriction that they have non-negative roots.

Let us define a “window of feasibility” W ( n ) in the plane as the rectangle of grid points [ 0, n + 1 ] × [ 0, n ] 2 . Suppose we are given a random p ( x ) [ x ] of the form x 2 α x + β with α , β 0 and β n . If p ( x ) factors as ( x r 1 ) ( x r 2 ) both roots are nonnegative and α = r 1 + r 2 and β = r 1 r 2 . If β > 0 these conditions imply that α n + 1 , and in the event β = 0 we impose this condition arbitrarily to ensure that all p ( x ) satisfying these conditions can be mapped in the obvious way to ( α , β ) W ( n ) . At the moment we have every point in W ( n ) as the image of some p ( x ) with α , β 0 . Clearly this is a bijective mapping. We call W ( n ) a window of feasibility since any p ( x ) with 0 < β n and α > n + 1 is necessarily impossible to factor. The motivation for constructing the window is to exclude those cases which overwhelm ordinary probability calculations. A quadratic inside the window may or may not be factorable, but if not, the reason will not be due to incommensurability of coefficients. Figure 2 shows this situation.

Note that a grid point of the form ( α ,0 ) corresponds to the quadratic x 2 α x = x ( x α ) , so factorization is always possible. A grid point of the form ( 0, β ) , provided β > 0 corresponds to the quadratic x 2 + β , which never factors.

Now denote by F ( n ) the grid points in W ( n ) corresponding to factorable polynomials. A factorable quadratic mapped to ( α , β ) must have α = r 1 + r 2 and β = r 1 r 2 for some r 1 , r 2 . Let us then plot pairs of roots on the W ( n ) grid and define ϕ ( r 1 , r 2 ) = ( α , β ) as the mapping that associates a root pair to the quadratic which factors with those roots. We will see shortly that there are substantial limitations on which points in W ( n ) can be root pairs. In other words,

Figure 2. Window of Feasibility for n = 9 . Grid points in shaded area are possible root pairs.

the domain of ϕ will be relatively small, so surjectivity will clearly be out of the question. We would like ϕ to be injective, and since ϕ ( r 1 , r 2 ) = ϕ ( r 2 , r 1 ) we impose the condition r 2 r 1 without loss of generality. Graphically, this amounts to eliminating all root pairs strictly above the line r 2 = r 1 . Now W ( n ) \ { ( r 1 , r 2 ) : r 2 r 1 } is still not F ( n ) since there is another important condition on the root pairs, namely r 1 r 2 n . The only admissible root pair grid points whenever r 2 > 0 are also below the hyperbola r 2 = n r 1 . This is also true trivially if r 2 = 0 so the hyperbola is an upper bound for all root pairs corresponding to factorable quadratics. Now we estimate the number of points in F ( n ) by calculating the area inside the region of the plane defined by the line r 2 = 0 , the line r 2 = r 1 , and the hyperbola r 2 = n r 1 . The area of this region is A = 0 n ( r 1 ) d r 1 + n n + 1 ( n r 1 ) d r 1 = n l n n + 3 n 2 . We estimate the number of grid points in F ( n ) by assuming one grid point per unit of area. This estimate is asymptotically exact. Now W ( n ) has ( n + 1 ) ( n + 2 ) total grid points. Finally, our conditional probability estimate is n l n n + 3 n 2 ( n + 1 ) ( n + 2 ) . We have proved:

3.1. Proposition 2

Given a random quadratic in [ x ] of the form x 2 α x + β , where α , β 0 , the approximate probability P ( n ) of factorization, subject to the conditions

α n + 1 and β n for fixed n , is given by P ( n ) = n l n n + 3 n 2 ( n + 1 ) ( n + 2 ) .

3.2. Corollary 2-1

With the notation of Proposition 2, P ( n ) is asymptotically l n n 2 n .

Proof. Divide numerator and denominator of n l n n + 3 n 2 ( n + 1 ) ( n + 2 ) by n to get l n n + 3 2 ( n + 3 + 2 n ) . Note that for large n we have l n n 3 and n 3 + 2 n . Hence n 1 implies P ( n ) l n n 2 n .

Unsurprisingly, letting n corresponds to α and β being chosen completely arbitrarily and we confirm that l i m n P ( n ) = 0 by L’Hôpital’s rule. The rate at which the likelihood of factorization declines is P ( n ) l n n 2 n 2 for large n, as would be expected.

For perspective, if n = 440 , the corresponding likelihood of factorability P ( 440 ) 1 % .

4. Factoring over -General Case

Consider the lattice cube L ( n ) = [ 0, n ] 3 3 as the three-dimensional analog of the preceding window of feasibility. The general quadratic [7] p ( x ) = α x 2 β x + γ [ x ] with α > 0 , β , γ 0 can be associated injectively with the point ( α , β , γ ) L ( n ) provided m a x { α , β , γ } n . Since α 0 , there are ( n 1 ) n 2 grid points in L ( n ) which represent distinct quadratics of this type. We would like to estimate the number of these which are factorable so that we can calculate the conditional probability P ( n ) of factorability in the manner of the finite field and monic cases above. Suppose p ( x ) does factor in as ( a x b ) ( c x d ) , with a , c > 0 and b , d 0 . Note that the greatest common divisor of α , β and γ does not appear as a separate factor but is considered to be bundled into the term ( a x b ) . Then α = a c , β = b c + a d , and γ = b d . Since the maximum α is n, it follows that admissible pairs ( a , c )

would satisfy c n a . As in the monic case, we embed 2 in 2 , calculate the appropriate area under the given hyperbola, and then assume one grid point (admissible pair) per unit of area with the understanding that this is asymptotically correct. The area in the first quadrant of the ac plane is 1 n n ( δ a ) a n = n l n n n = n ( l n n 1 ) . Since the maximum γ is n, but either b or d (or both) could be zero, the appropriate area in the first quadrant of the bd plane would be 1 n n ( δ b ) b + n = n l n n + n = n ( l n n + 1 ) . Evidently there are [ n ( l n n 1 ) ] [ n ( l n n + 1 ) ] = n 2 ( ( l n n ) 2 1 ) = F ( n ) expressions of the form ( a x b ) ( c x d ) which could factor the quadratic α x 2 β x + γ subject to the constraints imposed on those coefficients. Certainly not every point in L ( n ) corresponds to a factorable quadratic, but we can be assured that any points which are associated with a factorable quadratic have a factorization counted by F ( n ) . Since the factor pairs commute, we divide F ( n ) by two and it follows that the conditional probability of factorization is estimated by P ( n ) = F ( n ) 2 n 3 = n 2 ( ( l n n ) 2 1 ) 2 n 3 = ( l n n ) 2 1 2 n .

We have proved:

4.1. Proposition 3

Given a random quadratic in [ x ] of the form α x 2 β x + γ , where α > 0 , β , γ 0 and m a x { α , β , γ } n , an estimate for the probability P ( n ) of factorization is given by P ( n ) = ( l n n ) 2 1 2 n .

4.2. Corollary 3-1

With the notation of Proposition 3, P ( n ) is asymptotically ( l n n ) 2 n .

Table 1. Actual vs. Calculated-Monic Case.

n = coefficient bound; Calc = calculated P(n); Actual = actual P(n) by computer check.

Table 2. Actual vs. Calculated-General Case.

n = coefficient bound; Calc = calculated P(n); Actual = actual P(n) by computer check.

Figure 3. Probability of factoring P(n) vs. absolute coefficient bound n actual vs. calculated.

Proof. For n e , ( l n n ) 2 1 2 n ( l n n ) 2 2 n .

As expected, l i m n P ( n ) = 0 again by L’Hôpital’s rule.

5. Summary & Conclusions

We have described two methods for estimating the conditional probability that a random quadratic in [ x ] with non-negative bounded coefficients can be factored as a function of the bounding parameter. The simpler case is based on mapping monic quadratics injectively to a two-dimensional lattice in 2 and enumerating the formal expressions that could possibly represent factorizations of them. The ratio of the number of admissible formal factorizations to the total number of points in the lattice defines the conditional probability of factorization for the given coefficient bound. The more complicated case involves mapping general quadratics to a three-dimensional lattice in 3 and reprising the calculation for the two-dimensional case. Both methods have their provenance in the problem of calculating the likelihood that a quadratic over a finite field may be factored. In the case of finite fields, only a finite number of polynomials are possible and only a finite number of factorizations can be written, making the calculation a simple ratio. This fails, of course, for , but the point of our method is to resurrect the utility of finiteness by imposing a size limitation on coefficients [8].

Table 1 presents a comparison of values from the monic formula for conditional probability given by Proposition 2 with a computer generated census of factorable monic quadratics. There is reasonably close agreement, even for small n. The computer algorithm works by simply checking to see if the quadratic formula yields a rational number. Recall if a polynomial in [ x ] factors over , then it factors over .

Table 2 recaps a similar comparison for the general quadratics in Proposition 3. For the sake of simplicity we have ignored double counting certain factored expressions arising from symmetries (for example if a = c ). This overstates the calculated probability of factorization, especially for small n, so we may regard P ( n ) in this case as an upper bound for the true probability. In any case, our formula establishes P ( ) = 0 .

Below in Figure 3 a graph of the calculated P ( n ) versus n is shown as the continuous curve. The separate data points correspond to Table 1. The expected feature that l i m n P ( n ) = 0 is also evident.

To close on a philosophical note, although factorization of random quadratics over has been shown to be a progressively futile exercise, practicing pattern recognition with doable examples for small n is a worthwhile exercise that no doubt pays dividends elsewhere in mathematics.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

References

[1] Burton, D. (2005) Elementary Number Theory. McGraw-Hill Higher Education, Inc., New York, NY.
[2] Dummit, D.S. and Foote, R.M. (2014) Abstract Algebra. 3rd Edition, John Wiley and Sons, Inc., Hoboken, NJ.
[3] Gallian, J. (2010) Contemporary Abstract Algebra. 7th Edition, Cengage Learning.
[4] Morandi, P. (1996) Field and Galois Theory. Springer, Berlin.
https://doi.org/10.1007/978-1-4612-4040-2
[5] Lenstra, A., Lenstra, H. and Lovász, L. (1982) Factoring Polynomials with Rational Coefficients. Mathematische Annalen, 261, 515-534.
https://doi.org/10.1007/BF01457454
[6] Miller, V.S. (1992) Factoring Polynomials via Relation-Finding. In: Dolev, D., Galil, Z. and Rodeh, M., Eds., Theory of Computing and Systems ISTCS 1992, Lecture Notes in Computer Science, Vol. 601, Springer, Berlin, Heidelberg.
[7] Hart, W., Hoeij, M. and Novocin, A. (2011) Practical Polynomial Factoring in Polynomial Time. Proceedings of the International Symposium on Symbolic and Algebraic Computation (ISSAC), San Jose, CA, 163-170.
https://doi.org/10.1145/1993886.1993914
[8] Ostrowski, A.M. (1975) On Multiplication and Factorization of Polynomials I, Aequationes Mathematicae, 13, 201-228.
https://doi.org/10.1007/BF01836524

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.