Picard group of blowup of smooth variety If $X$ is a smooth irreducible variety and $Y$ is the blowup of $X$ at a point $p$ then

Prove that $Pic(Y) = Pic(X)+$$\mathbb Z$

I was thinking about using the fact that the blowup map $p : Y \to X$ is birational and the $\mathbb Z$ part of the RHS should come from the exceptional divisor. But I am unable to fully formulate.
Any help is appreciated.
 A: I hope it will help you
Let $\pi:Y=Bl_p(X)\to X$ be the blow up of $X$ at the point $p$, then define the map $\phi:pic(X)\oplus \mathbb{Z}\to pic(Y)$ by
$\phi(\mathcal{L},m)= \pi^*(\mathcal{L})\otimes \mathcal{O}_X(mE)$, where $E$ is the exceptional divisor.
On the othe hand, we know that $Y$ and $X$ are birrationals, moreover, $Y-E \cong X-\{p\}$, then $pic(Y-E)\cong pic(X-\{p\})$, but by proposition 6.5, chap. II, Hartshorne, $pic(X-\{p\})\cong pic(X)$, so you can think as $\phi:pic(Y-E)\oplus \mathbb{Z}\to pic(Y)$,which is clearly epijective, indeed, if you take (assuming for the sake of simplicity X, Y are smooth) a divisor $D$ on Y, we can write $D=(D-tE)+tE$, the number $t$ is the multiplicity of $E$ at $D$, so $\phi(D-tE,t)=D$. With that only remains to show that $\phi$ is inyective, in order to do this consider the morphisms betweeen fields $\pi^*:k(X)\to k(Y)$, therefore if $\mathcal{O}_Y(mE)\cong \mathcal{O}_X$, there exists a function $g\in k(Y)$ such that $div(g)=mE$, it goes to zero at $k(X)$, i.e., $\pi^*(g)=0\in k(X)$, so $\pi^*(g)$ never vanish, then $g$ is zero, which implies that $m=0$, so $\phi$ is injective, and  therefore it is an isomorphism.
