Hartshorne's book Algebraic Geometry, Chapter IV Exercise 1.8 confuses me a bit. It first assumes $X$ is an integral projective scheme of dimension 1 over a field (I assume algebraically closed) $k$. Then in part (b) of the Exercise it says that if the arithmetic genus of $X$ is $0$ then $X$ must be nonsingular. But the cubic curve $y^2-x^3=0$ on the plane is singular and has genus $0$. What am I missing here?
Confusion in Hartshorne exercise IV.1.8
algebraic-geometrycurves
Related Solutions
A compact Riemann surface $X$ is in particular a compact real orientable surface. These surfaces are classified by their genus.
That genus is indeed the number of handles cited in popular literature; more technically it is
$$g(X)=\frac {1}{2}\operatorname {rank} H_1(X,\mathbb Z) = \frac {1}{2}\operatorname {dim} _\mathbb C H^1_{DR}(X,\mathbb C) $$ in terms of singular homology or De Rham cohomology.
Under the pressure of arithmetic, geometers have been spurred to consider the analogue of compact Riemann surfaces over fields $k$ different from $\mathbb C$: complete smooth algebraic curves.
These have a genus that must be calculated without topology.
The modern definition is (for algebraically closed fields) $$ g(X)=\operatorname {dim} _k H^1(X, \mathcal O_X)= \operatorname {dim} _kH^0(X, \Omega _X)$$
in terms of the sheaf cohomology of the structural sheaf or of the sheaf of differential forms of the curve $X$.
Of course this geometric genus is always $\geq 0$.
There is a more general notion of genus applicable to higher dimensional and/or non-irreducible varieties over non algebraically closed fields: the arithmetic genus defined by $$p_a(X)=(-1)^{dim X}(\chi(X,\mathcal O_X)-1)\quad {(ARITH)}$$ (where $\chi(X,\mathcal O_X)$ is the Euler-Poincaré characteristic of the structure sheaf).
[ Hirzebruch and Serre have, for very good reasons, advocated the modified definition $p'_a(X)=(-1)^{dim X}\chi(X,\mathcal O_X)$, which Hirzebruch used in his ground-breaking book and Serre in his foundational FAC]
For smooth projective curves over an algebraically closed field $g(X)=p_a(X)\geq 0$ : no problem.
It is only in more general situations that the arithmetic genus $p_a(X)$ may indeed be $\lt 0$
Edit
The simplest example of a reducible variety with negative arithmetic genus is the disjoint union $X=X_1\bigsqcup X_2$ of two copies $X_i$ of $\mathbb P^1$.
The formula $(ARITH)$ displayed above yields: $p_a(X)=1-\chi(X,\mathcal O_X)=1-(dim_\mathbb C H^0(X,\mathcal O_X)-dim_\mathbb C H^1(X,\mathcal O_X))=1-(2-0)$
so that $$p_a(X)=p_a(\mathbb P^1\bigsqcup \mathbb P^1)=-1\lt0$$
You don't need to show this: if $Y'\subset Z(f_r)$, then intersecting doesn't drop it's dimension, which is just fine. (Remember, you want to show that the dimension of each irreducible component is at least $n-r$, so if it's bigger, this is acceptable.)
Suppose there were a closed irreducible subset of $Y'\cap Z(f_r)$ properly containing $Y$. Then this would also be a closed irreducible subset of $Z(\mathfrak{a})$ properly containing $Y$, which contradicts the fact that $Y$ is an irreducible component (and thus maximal with respect to containment by irreducible subsets) of $Z(\mathfrak{a})$.
Also, you're correct that you don't need to assume that $H$ is the zero set of an irreducible polynomial. Suppose $H=Z(fg)$: then $H=Z(f)\cup Z(g)$, so $Y\cap H = (Y\cap Z(f))\cup (Y\cap Z(g))$, and so everything works out just fine.
Finally, I'd like to point out that you can skip both of these issues: the idea is that for an irreducible variety $Y$ and a hypersurface $H$, all irreducible components of $Y\cap H$ have dimension $\dim Y$ or $\dim Y-1$ depending on whether they're contained in $H$ or not, respectively. So what you want to do is start with $X=\Bbb A^n$, intersect it with $Z(f_1)$, get a list of irreducible components of $Z(f_1)$ of codimension 0 or 1, intersect these with $Z(f_2)$, get a list of irreducible components of $Z(f_1,f_2)$ of codimension 0, 1, or 2, and continue on until you get a list of irreducible components of $Z(f_1,\cdots,f_r)$ of codimension at most $r$ (aka dimension at least $n-r$) and then you've finished the exercise.
Best Answer
To start, the cubic curve $y^2-x^3=0$ is not projective. More importantly, the (naive) projectivization $V(y^2z-x^3)$ has arithmetic genus $1$ via the degree-genus formula. (Fear not - the exercise is correct as written.)