Canonical sheaf projective bundle Given a smooth variety $Y$, and a vector bundle $E$ of rank $r+1$ defined on it, call $X$ the variety associated to the projective bundle given by $E$. Call $\pi: X \rightarrow Y$ the natural map.
For such a situation, I found the formula $K_X=-(r+1)\xi+\pi^*(K_Y+det(E))$, where $\xi$ denotes the class of the natural line bundle $\mathcal{O}_X(1)$ on $X$. If we clear $\pi^*K_Y$ from the formula it boils down to saying that the relative canonical is given by $-(r+1)\xi + \pi^*(det(E))$.
I have not found a proof for this fact.
Is it just a "glueing" of the Euler sequence, where $\pi^*det(E)$ gives the transition function for the local trivializations we choose to write the Euler sequence locally over an affine of $Y$? Also, does this formula generalize if $Y$ is singular?
Thank you.
Edit/Note: In my refenrence $\mathbb{P}(E)$ is thought as the projective space of one dimensional quotients. I believe that in the answers below $det(E)$ appears with an additional dual because the construction is done with projective space of lines.
 A: Yes, it's from the relative Euler sequence on $X$,
$$0 \to \Omega_{X/Y} \to \mathcal{O}_X(-1) \otimes \pi^*(E^\vee) \to \mathcal{O} \to 0$$
which shows that $c_1(\Omega_{X/Y}) = c_1(\mathcal{O}_X(-1) \otimes \pi^*(E^\vee))$. This comes from dualizing and twisting the tautological sequence
$$0 \to \mathcal{O}_X(-1) \to \pi^*E \to Q \to 0,$$
corresponding to the fact that $X = \mathbb{P}(E)$ is the bundle of lines of $E$. 
That said, I am getting a slightly different equation from you:
$$c_1(\Omega_{X/Y}) = -rk(E) \cdot \xi - \pi^*\det(E).$$
I believe your rank is off by 1 and that you have the sign backwards on the $\det(E)$ term; this might just be conventions (vector bundle rank versus projective bundle rank; bundle of lines versus bundle of hyperplanes).
A: Let $\pi:X=\mathbb P(E)\to Y$ be the projection. Here $r+1$ is the rank of $E$. We use the following short exact sequences:
$$
\begin{align}
0&\to T_{X/Y}\to T_X\to \pi^\ast T_Y\to 0\,\,\,\,\,\,\qquad (\star)\\
0&\to\mathscr O_X(-1)\to \pi^\ast E\to Q\to 0.\qquad (\star\star)
\end{align}
$$
The latter is the tautological exact sequence over $X=\mathbb P(E)$, in particular $Q$ denotes the universal quotient bundle, which has rank $r$.
Hence $(\star\star)$ says that $$\pi^\ast(\det E)=\mathscr O_X(-1)\otimes\det Q.$$
From $(\star)$, we get that $$K_X=\det T_{X/Y}^\vee\otimes \pi^\ast(\det T_Y^\vee)=\det T_{X/Y}^\vee\otimes \pi^\ast K_Y.$$
Using that 
$$
T_{X/Y}=Hom_X(\mathscr O_X(-1),Q)=\mathscr O_X(1)\otimes Q
$$
we see that $\det T_{X/Y}=\mathscr O_X(r)\otimes \det Q$, and dualizing we get $$\det T_{X/Y}^\vee=\mathscr O_X(-r)\otimes\det Q^\vee=\mathscr O_X(-r-1)\otimes \pi^\ast \det E^\vee.$$
Conclusion:
$$K_X=\mathscr O_X(-r-1)\otimes \pi^\ast \det E^\vee\otimes \pi^\ast K_Y.$$

Note that one can read, in the above formula, the expression of the relative dualizing sheaf of the (smooth) family $X\to Y$, i.e. $K_{X/Y}=K_X\otimes \pi^\ast K_Y^\vee$. Indeed, in the smooth case we have $K_{X/Y}=\det \Omega^1_{X/Y}=\det T_{X/Y}^\vee$.
