# (Anti)Canonical divisor of a blow up

This question may be utterly trivial, or not, but as someone with hardly any knowledge of algebraic geometry I thought there could be a chance I get lucky.

Let X be a rational surface obtained by n blows up of $\mathbb{P}^1(\mathbb{C})\times\mathbb{P}^1(\mathbb{C})$. I write $H_x$ and $H_y$ for the lines x=constant and y=constant, and $E_i$ for the total transform of the point of the $i-th$ blow up. Is there some way to find what the canonical divisor on X is? Take for example the surface X blown up at the point $x=\infty$ , $y=\infty$, and then again on that divisor at some point.

(This example above occured when I cooked up an example to try and understand the resolution of singularities for the simple mapping x(n+2)+ax(n+1)+bx(n)=0).

I have seen for example, that the canonical divisor of $\mathbb{P}^2(\mathbb{C})$ blown up at 9 points is given by $K_X=-3H+E_1+E_2+...+E_9$. Is this true in general or only for a special class of surfaces?

-

If p:Y->X is the blowup of the surface X at a point x, and E is the exceptional divisor, then $K_Y=p^*K_X+E$. Hence the formula for the blowup of P^2 at 9 points. In the $P^1 \times P^1$ case, the canonical divisor is $-2(H_x+H_y)$, and you can compute the canonical divisor on the blowup easily. You can find all this in any book on algebraic surfaces, I bet.
The product $\mathbb{P}^1\times\mathbb{P}^1$ is quadric surface $X\subset\mathbb{P}^3$. The canonical divisor is $K_X = -2H_X$, where $H_X = X\cap H$, and $H$ is the hyperplane section. Blowing-up a point in $X$ you get a surface $X_1$ with $$K_{X_1} = -2H_X+E_1.$$ In general blowing-up $k$ points in $X$ you have $$K_{X_k} = -2H_{X}+E_1+...+E_k.$$ Now, take $X_1$ and blow-up a point $p\in E_1$. Let $\pi:Y\rightarrow X_1$ be the blow-up. Then $-K_Y = \pi^*K_{X_1}+E_2$. We have $\pi^*K_{X_1} = \pi^*(-2H_X+E_1) = -2H_X+E_1+E_2$ because $p$ is a smooth point of the curve $E_1$. Therefore $$-K_Y = \pi^*K_{X_1}+E_2 = -2H_X+E_1+2E_2.$$ Then, you can go on like this. Of couse here I am using the same notation for a curve and its strict transform.