Why can you check closedness on the fibers? (Hartshorne's proof of Bertini's theorem)

In Hartshorne's proof of Bertini's theorem, given a linear system $$|H|$$, he defines the locus of "bad" hyperplanes $$B_x$$ for each point $$x\in X\subset \Bbb P^n$$ a projective variety, shows that this is a proper linear subset of $$\{x\}\times |H|$$, defines $$B$$ to be the union of all pairs $$(x,H)$$ so that $$H\in B_x$$, and then claims that "clearly $$B$$ is the set of closed points of a closed subset of $$X\times|H|$$".

I don't understand this. Clearly the statement "if a subset has proper closed intersection with all fibers of a map over closed points, then it's a proper closed subset" is false - consider the inclusion of a copy of $$(\Bbb P^1\setminus\{0\})\times\{p\} \to \Bbb P^1\times\Bbb P^1$$ followed by a projection. How can I rigorously see Hartshorne's claim?

• Yes, topologically speaking it’s clearly wrong (you could simply imagine a reunion of random closed subsets of each fiber). The only way I can think of to salvage the claim is if the condition $H \in B_x$ is closed wrt $(x,H)$. Nov 24 '20 at 22:38
• @Mindlack Thanks for the comment. What do you mean "the condition $H\in B_x$ is closed wrt $(x,H)$"? How could I check that? Nov 24 '20 at 22:39
• @Mindlack Let $f$ be the homogeneous linear form cutting out $H$. Fix $f_0$ a homogeneous linear form not vanishing at $x$. $H\in B_x$ if $f$ is in the kernel of the map from all homogeneous linear forms to $O_{X,x}/m_x^2$ given by sending $f\mapsto f/f_0$. Would still love to know what you mean by "closed wrt $(x,H)$"!. Nov 24 '20 at 22:47
• (Before I read your latest comment) Is the condition “$H \in B_x$” equivalent to the vanishing of some rational functions of $(x,H)$? Nov 24 '20 at 22:47
• Right. So find a finite cover of $X$ by finitely many open subsets (cut out as the nonzero loci of homogenous linear forms) – topology should ensure the global result from the result on each of these open subsets. So let $f_0$ be a linear form not vanishing on $X$. Then, if $H$ is represented by the linear form $f$, $H \in B_x$ iff $f/f_0 \in m_x^2$ iff $f/f_0 \in m_x$ and $(f/f_0)’ \in m_x$ (I think – as $X$ is smooth). And these conditions are polynomial in affine coordinates of $X$. (Disclaimer: you’d better double check that yourself, because I’m not sure I didn’t make any mistakes here). Nov 24 '20 at 23:06

I pieced this together after the discussion with Mindlack in the comments. Define $$B$$ to be the subset of $$X\times\Bbb P^n$$ cut out by the minors of size $$n-\dim X+1$$ of the matrix $$\begin{pmatrix} \frac{\partial f_1}{\partial x_0} & \cdots & \frac{\partial f_1}{x_n} \\ \vdots & \ddots & \vdots \\ \frac{\partial f_m}{\partial x_0} & \cdots & \frac{\partial f_m}{x_n} \\ a_0 & \cdots & a_n \end{pmatrix}$$
where $$f_i$$ are a generating set for $$X$$ and $$a_j$$ are coefficients for the hyperplane $$V(\sum a_jx_j)$$ where the $$x_j$$ are coordinates on $$\Bbb P^n$$. It's not so hard to see that the vanishing of all of these minors at a point $$x\in X$$ means that the dehomogenization of $$\sum a_jx_j$$ is in the square of the maximal ideal there via the Jacobian criterion. This exactly gives $$B_x$$ as the fiber of $$B$$ over $$x$$.