TITLE: How do I compute the number of intersection points of these three surfaces in $\mathbb A^3$
QUESTION [9 upvotes]: The setting (ambient space) for this question is the projective space $\mathbb P^3$ over an algebraically closed field $k$, with homogeneous coordinates $x,y,z,w$. We choose $w = 0$ as the plane at infinity.
Let $P, Q, R$ be surfaces of degree $d+1$ in $\mathbb P^3$, whose set-theoretic intersection is the union of a finite number of points in $\mathbb A^3$ and a curve $C$ of degree $d$ on the plane at infinity. Assume none of $P, Q, R$ contains the plane at infinity. My goal is to find the number of intersection points in $\mathbb A^3$, counted with multiplicity. I expect this number to be exactly
$$d^3 + d^2 + d + 1 = (d^2 + 1)(d + 1),$$
and this can be proven to be the case when $k = \mathbb C$, using complex analytic methods.
We shall identify $P, Q, R$ with their defining polynomials in $k[x,y,z,w]$. Similarly, we shall identify $C$ with its defining polynomial in $k[x,y,z]$. Then we may write
$$P = xC - wF, \qquad Q = yC - wG, \qquad R = zC - wH,$$
where $F, G, H$ are homogeneous polynomials of degree $d$.

FAILED ATTEMPT: My original strategy was to proceed as follows:

Replace $R$ with a sufficiently general surface $S$, also of degree $d+1$.

Assume $P \cap Q \cap R$ and $P \cap Q \cap S$ have the same number of points in $\mathbb A^3$.

Count how many points $P \cap Q \cap S$ has on the plane at infinity (i.e., on $C$), and subtract them from $(d + 1)^3$.


Unfortunately, this does not work. Using numerical experiments, I have found that $P \cap Q \cap S$ might have up to $d^3 + 2d^2 + 2d + 1 = (d^2 + d + 1) (d + 1)$ points in $\mathbb A^3$, violating assumption 2.

CURRENT STRATEGY: From now on, consider

$A = k[x,y,z,w]$, the homogeneous coordinate ring of $\mathbb P^3$.
$\mathfrak a = (P)$, the ideal of the first surface.
$\mathfrak b = (P, Q)$, the ideal of the intersection of the first two surfaces.
$\mathfrak c = (P, Q, R)$, the ideal of the intersection of all three surfaces.

First we show that $P, Q, R$ are pairwise coprime. By assumption, none of them is a multiple of $w$. Now suppose two of them, say $P$ and $Q$, had a common prime factor. This factor would be an irreducible component of $P \cap Q$ that is mostly contained in $\mathbb A^3$. Hence $P \cap Q \cap R$ would contain a curve mostly contained in $\mathbb A^3$, which we have assumed is not the case.
Since $A/\mathfrak a$ and $A/\mathfrak b$ are complete intersections, we have the exact sequences
$$
0 \longrightarrow A(-d-1)
  \longrightarrow A
  \longrightarrow A/\mathfrak a
  \longrightarrow 0
$$
and
$$
0 \longrightarrow A/\mathfrak a(-d-1)
  \longrightarrow A/\mathfrak a
  \longrightarrow A/\mathfrak b
  \longrightarrow 0.
$$
On the other hand, $A/\mathfrak c$ is not a complete intersection, so $R$ must be a zero divisor in $A/\mathfrak b$. Then we have a short exact sequence of the form
$$
0 \longrightarrow K
  \longrightarrow A/\mathfrak b(-d-1)
  \longrightarrow A/\mathfrak b
  \longrightarrow A/\mathfrak c
  \longrightarrow 0,
\DeclareMathOperator \Hilb {Hilb}
$$
where $K$ is not trivial. Taking Hilbert polynomials, we have

$\Hilb_A(n) = \binom {n+3} 3$
$\Hilb_{A/\mathfrak a}(n) = \Hilb_A(n) - \Hilb_A(n-d-1)$
$\Hilb_{A/\mathfrak b}(n) = \Hilb_{A/\mathfrak a}(n) - \Hilb_{A/\mathfrak a}(n-d-1)$
$\Hilb_{A/\mathfrak c}(n) = \Hilb_{A/\mathfrak b}(n) - \Hilb_{A/\mathfrak b}(n-d-1) + \Hilb_K(n) = (d + 1)^3 + \Hilb_K(n)$

Now consider a prime filtration of the form
$$0 = M_0 \subset M_1 \subset \dots \subset M_r = A/\mathfrak c,$$
and let $\mathfrak p_i$ be the prime ideals such that $M_i/M_{i-1} = A/\mathfrak p_i(d_i)$. Each $\mathfrak p_i$ is one of the following:

The prime ideal of the curve $C$, i.e., $\mathfrak p$.
The prime ideal of an embedded point on $C$.
The prime ideal of an isolated intersection point in $\mathbb A^3$.
The irrelevant ideal $\mathfrak m = (x,y,z)$.

We may ignore any occurrences of $\mathfrak m$, because they do not contribute to $\Hilb_{A/\mathfrak c}(n)$. So we need to compute

The $A$-module $K$, or at least enough information to recover $\Hilb_K(n)$.
The number of embedded points in $C$, counted with multiplicity.
The degree of the Serre twist applied to $A/\mathfrak p$, wherever it might occur in the prime filtration.

How do I even begin to do this?

BAD NEWS: Using even more numerical experiments, I have found that I was careless when stating the problem.
The actual problem that I am trying to solve is the following. I have an algebraic foliation of $\mathbb P^3$ by curves, defined in $\mathbb A^3$ by the polynomial vector field
$$\mathcal F : P^\flat \frac \partial {\partial x} + Q^\flat \frac \partial {\partial y} + R^\flat \frac \partial {\partial z},$$
where $P^\flat, Q^\flat, R^\flat$ denote the dehomogenizations (i.e., setting $w = 1$) of the polynomials $P, Q, R$ at the beginning of this post. We further assume that $\mathcal F$ contains only isolated singularities. If the plane at infinity is chosen generically, then all the singularities are in $\mathbb A^3$, and the curve $C$ mentioned above is the set of points on the plane at infinity where $\mathcal F$ is tangent to this plane.
It follows from these assumptions that $P, Q, R$ have the form stated above:
$$P = xC - wF, \qquad Q = yC - wG, \qquad R = zC - wH.$$
However, the implication is strict. It does not follow from these three equations that $\mathcal F$ does not have singularities on the plane at infinity! Could someone help me find an algebraically precise way to state, in terms of $P, Q, R, C, F, G, H$, that $\mathcal F$ does not have singularities on the plane at infinity?

REPLY [2 votes]: You might be able to use the excess intersection formula for this.
The issue is, I'm not sure what happens if the curve $C$ at infinity is singular, that might have to be accounted for, but since it is a plane curve, maybe it would be OK. Note that the arithmetic genus of $C$ is $\frac{(d-1)(d-2)}{2}$ if it is scheme-theoretically contained in the plane at infinity -- do you know if $C$ is reduced?
See e.g. Proposition 13.2 of Eisenbud & Harris's 3264 and all that, which precisely discusses your situation. (https://scholar.harvard.edu/files/joeharris/files/000-final-3264.pdf)

Proposition 13.2. Let $S_1, S_2, S_3 \subset \mathbb{P}^3$ be surfaces of degrees $d_1, d_2, d_3$ whose intersection is a zero-dimensional scheme $\Gamma$ and a smooth curve $C$ of degree $d$ and genus $g$. Then $$d_1d_2d_3 = \deg(\Gamma) + d(d_1+d_2+d_3) - (4d + 2g - 2).$$

Applying this with $d_1 = d_2 = d_3 = d+1$ and $g = \frac{(d-1)(d-2)}{2}$ gives
$$\deg(\Gamma) = (d+1)^3 - 3d(d+1) + (4d + (d-1)(d-2) - 2)$$
$$= (d+1)(d^2+1),$$
which is the number you wanted.
EDIT: I haven't tried to analyze the approach you attempted, but reasoning with Hilbert polynomials seems rather similar to the underlying reasoning of this excess intersection formula, which involves (a) restricting the line bundle $\mathcal{O}(d+1)$ to $C$ (to get the normal bundle $N_{C/S}$ of $C$ along $S$), plus (b) accounting for the genus of $C$ in some way.
If $C$ isn't contained in a plane, then you can see from the formula that the genus of $C$ (which is no longer determined by the degree) affects the expected number of isolated intersection points, so just knowing $\deg(C)$ isn't enough.