# Probability that random cubic polynomials meet in a square

Let $p_1(x)$ and $p_2(x)$ be cubic polynomials with random coefficients in $[-1,1]$. I wanted to compute the probability that $p_1$ and $p_2$ share at least one point within the square $[-1,1]^2$. Of course this is the same as the probability that $p_1(x)=p_2(x)$ for $x \in [-1,1]$ and $p_1(x) \in [-1,1]$. I am not seeing this as a straightforward computation based on known root distribution results for random polynomials, but I admit to ignorance in this area. Crude experimentation suggests the probability might not be far from $\frac{1}{2}$. Below, $5$ out of $9$ instances meet within the $[-1,1]^2$ square.

My interest derives from graphics and cubic splines. I wanted to understand how likely it would be that the (relatively expensive) root computation would be necessary to compute certain graphic representations, e.g., visibility from above.

• I simulated 100,000 cases, and the result in the form of {# of zeros, frequency (%)} is as follows: {{0, 39.179}, {1, 48.567}, {2, 10.847}, {3, 1.407}} That is, about 40% of total cases had no zero. Feb 22, 2014 at 5:26
• For what it's worth, this is exactly a question about the number of roots in [-1,1] of a random cubic with coefficients taken from a "witch's hat" distribution on [-2,2]. Feb 22, 2014 at 6:49
• @Anthony Quas: That ignores the restriction on the $y$-coordinate. The graphs of $(x^3+3x)/3$ and $(3x^2+1)/3$ meet at $(1,4/3)$ which is outside $[-1,1]^2$. Feb 22, 2014 at 9:21
• Indeed, the Mathematica command Probability[ And @@ (-1 <= # <= 1 & /@ {x, a x + b} /. Solve[a x + b == c x + d, x] // First), {a, b, c, d} \[Distributed] UniformDistribution[{{-1, 1}, {-1, 1}, {-1, 1}, {-1, 1}}]] gives the exact result $47/96\approx0.48958...$. Feb 22, 2014 at 19:21
• If you don't restrict the $y$-coordinate of the intersection then the probability for two lines is exactly $1/2$ by the involution swapping the linear and constant coefficients. The x-coordinate of the point of intersection of $\lbrace a_i x + b_i\rbrace$ is $-\frac{b_1-b_0}{a_1-a_0}$. The deficit from $1/2$ comes from the times the lines intersect with $x \in [-1,1], y \notin [-1,1]$ like $0.3 x + 0.9$ and $0.8 x + 0.5$ which intersect at $(0.8,1.14)$. Feb 22, 2014 at 20:09

If $p_i(x)=a_ix^3+b_{i,2}x^2 + b_{i,1}x + b_{i,2}$ for $i\in\{1,2\}$ then a sufficient condition for $\exists (x,y)\in [-1,1]^2$ with $y=p_1(x)=p_2(x)$ is that (writing $a=a_1-a_2$, $b_j=b_{1,j}-b_{2,j}$) \begin{eqnarray} \tag{1}\sum_{j=0}^2 |b_{j}|\le |a|\quad\text{and}\\ \tag{2}|a_i| + \sum_{j=0}^2 |b_{i,j}| \le 1\quad\exists i\in\{1,2\} \end{eqnarray} and this gives a nonzero lower bound of approximately $0.02$ on the probability (an 8-fold multiple integral which it is tricky to get Mathematica to do).
Indeed, it is easy to see that with probability 1 there exist $(x,y)\in\mathbb R^2$ with $y=p_1(x)=p_2(x)$; consider one such pair. If $|x|\ge 1$ then we have by (1) $$|ax|\le |b_2| + \frac{|b_1|}{|x|} + \frac{|b_2|}{|x|^2} \le \sum_j |b_j|\le |a|$$ so $|x|\le 1$ after all. To ensure $|y|\le 1$ we use (2).