# (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.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8521102,"math_prob":0.9999074,"size":953,"snap":"2022-27-2022-33","text_gpt3_token_len":272,"char_repetition_ratio":0.12012645,"word_repetition_ratio":0.0,"special_character_ratio":0.27701995,"punctuation_ratio":0.08292683,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":1.0000058,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-08-19T11:20:04Z\",\"WARC-Record-ID\":\"<urn:uuid:204ac84c-fff7-4799-892b-594eb870ad80>\",\"Content-Length\":\"110118\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b4f8e08e-25ad-4ec0-b8e1-a42ae06fefd9>\",\"WARC-Concurrent-To\":\"<urn:uuid:3c61ca07-ea9f-4091-a74e-d0f6f2312af4>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://mathoverflow.net/questions/75284/anticanonical-divisor-of-a-blow-up/75289\",\"WARC-Payload-Digest\":\"sha1:BLCZAEJFSPBWCGV2HOF5JI5AVHK3NDW6\",\"WARC-Block-Digest\":\"sha1:VD7C5UQXHCRVPDFBUBEQQDJDMRZEPYCN\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-33/CC-MAIN-2022-33_segments_1659882573667.83_warc_CC-MAIN-20220819100644-20220819130644-00555.warc.gz\"}"}