text:
\section{Fibrations in 1-category theory}\label{1catsec}

Loosely, a \emph{fibration} is a functor $p\colon E \ra B$ such that the fibers $E_b$ depend contravariantly and pseudo-functorially on the objects $b \in B$. Many categories are naturally \emph{fibered} in this way.

\subsection{Discrete fibrations} We start with an easier variant  where the fibers are discrete categories.

\begin{defn} A functor $p \colon E \ra B$ is a \emph{discrete fibration} if for each object $e \in E$ and arrow $f\colon b' \ra pe \in B$, there exists a unique lift $g\colon e' \ra e$.
\end{defn}

\eadd{In particular, for each $b \in B$ and object $e \in E_b$ in the fiber, there can be at most one lift of $1_b$ with codomain $e$. This proves that the fibers $E_b$ of a discrete fibration are discrete categories.}

Let $\DFib(B)$ denote the category of discrete fibrations over $B$, defined to be a full subcategory of the comma category $\Cat_{/B}$. Two facts about discrete fibrations are particularly important, the first of which we explore now.

\begin{thm}\label{thm:discrete-equiv} There is an equivalence of categories \[\DFib(B) \simeq [B^{\op},\Set].\]
\end{thm}
\begin{proof}
Given a discrete fibration $E \ra B$, define $B^{\op} \ra \Set$ by $b \mapsto E_b$, the category whose objects sit over $b \in B$ and whose arrows map to the identity at $b$.
 For each morphism $f\colon b' \ra b$, define $f^* \colon E_b \ra E_{b'}$ by mapping $e \in E_b$ to the domain of the unique lift of $f$ with codomain $e$. Functoriality follows from uniqueness of lifts.

Conversely, given a functor $F\colon B^{\op} \ra \Set$, the canonical functor from its \emph{category of elements} $\comma{*}{F}$ to $B$ is a discrete fibration.  The category of elements construction is defined by applying the comma construction to opspans whose domain leg is fixed at $*\colon \mathbb{1} \to \Set$. In this way, the comma construction defines a functor $\comma{*}{-}\colon [B^\op, \Set] \to \Cat_{/B}$ whose value at $F \in [B^\op,\Set]$ is  a discrete fibration $\Sigma \colon \comma{*}{F}\to B$.

The comma category $\comma{*}{F}$, whose objects are elements of $Fb$ for some $b \in B$, is sometimes called the \emph{Grothendieck construction} on the presheaf $F$. We leave the verification that these functors define inverse equivalences to the reader.
\end{proof}

There is an ``internal'' rephrasing of the definition of a discrete fibration. Write $B_0$ for the set of objects and $B_1$ for the set of arrows of a small category $B$.

\begin{defn}\label{internaldefn} A functor $p : E \ra B$ between small categories is a \emph{discrete fibration} iff \[ \xymatrix{ E_1 \ar[d]_{p_1}  \ar@{}[dr]|(.2){\lrcorner}\ar[r]^{\cod} & E_0 \ar[d]^{p_0} \\ B_1 \ar[r]_{\cod} & B_0}\] is a pullback in $\Set$.
\end{defn}

 The second key property of discrete fibrations requires the following definition.

\begin{defn}
A functor $f \colon C \ra D$ is \emph{final} if any diagram of shape $D$ can be restricted along $f$ to a diagram of shape $C$ without changing its colimit. This is the case just when  for all $d \in D$, the comma category $\comma{d}{f}$ is non-empty and connected.
\end{defn}

\begin{prop}[\protect{\cite{MR0346027}}]\label{thm:dfib-ofs} There is an orthogonal factorization system $(\mathcal{E},\mathcal{M})$ on $\Cat$ with $\mathcal{E}$ the final functors and $\mathcal{M}$ the discrete fibrations.\footnote{This is usually called the \emph{comprehensive factorization system}. In \cite{lawvere1970equality} Lawvere defines the notion of a \emph{comprehension scheme} as a pseudofunctor $P \colon \mathcal E \to \text{Adj} $, sending a 1-cell $f \colon A\to B$ to an adjoint pair $Pf_! \colon PA\leftrightarrows PB \colon Pf^*$. Under suitable assumptions, such a $P$ defines a factorization system in $\mathcal E$ formed by classes of arrows called the $P$-\emph{connected} and $P$-\emph{covering} maps. When $\mathcal E = \Cat$ and $P$ is the presheaf construction $A\mapsto [A^\text{op}, \Set]$, a functor is $P$-connected if and only if it is final, and it is a $P$-covering if and only if it is a discrete fibration. See \cite{berger2017comprehensive} for a generalization to any `consistent' comprehension scheme.}
\end{prop}

The dual notion, functors $p \colon E \ra B$ which have unique lifts of morphisms with specified domain, are called \emph{discrete opfibrations}, which coincide with discrete fibrations $p \colon E^{\op} \ra B^{\op}$. These correspond  to functors $B \ra \Set$ and form an orthogonal factorization system with the class of \emph{initial} functors which are those such that restriction preserves limits.

\subsection{Fibrations} Now we're ready to introduce the main subject of our exposition.
\begin{defn}\label{defn:1-fib} Given a functor $p \colon E \ra B$, an arrow $g \colon e' \ra e$ in $E$ is $p$-\emph{cartesian} if for any $g'\colon e'' \ra e$ such that $pg' = pg \cdot h$ in $B$, there is a unique lift $k$ of $h$ such that $g' = g \cdot k$. A functor $p :E \ra B$ is a \emph{fibration} if each $f: b \ra pe$ in $B$ has a $p$-cartesian lift with codomain $e$.
\end{defn}

Some sources differentiate between fibrations and those \emph{cloven} fibrations which come with chosen cartesian lifts which may satisfy additional properties. See \cite{grayfibred} or the $n$Lab.

\begin{thm}\label{catadjthm} A functor $p \colon E \ra B$ is a fibration if and only if either
\begin{enumroman}
\item For each $e \in E$, the functor $p\colon \comma{E}{e} \ra \comma{B}{p(e)}$ has a right adjoint right inverse.
\item The canonical functor $E^\2 \ra \comma{B}{p}$ obtained applying $p$ has a right adjoint right inverse.
\end{enumroman}
\end{thm}
\begin{proof} In each case, the right adjoint picks out $p$-cartesian lifts for each morphism. See \cite[Prop 3.11]{grayfibred}.
\end{proof}

Let $\Fib(B)$ denote the sub 2-category of $\Cat_{/B}$ of fibrations; \emph{cartesian functors}, those functors that preserve cartesian arrows; and all 2-cells.

\begin{thm} There is a 2-equivalence of 2-categories \[\Fib(B) \simeq {\bf Psd}[B^{\op},\Cat],\] where the latter is the 2-category of pseudo-functors $B^\op \rightsquigarrow \Cat$, pseudo-natural transformations, and modifications.
\end{thm}
\begin{proof}
A fibration $E \ra B$ gives rise to a pseudo-functor $b \mapsto E_b$, $f \colon b' \ra b \mapsto f^*\colon E_b \ra E_b'$. By the universal property of the cartesian lifts, this assignment is functorial up to natural isomorphism. In the other direction, the lax colimit of a pseudo-functor $B^{\op} \rightsquigarrow \Cat$ is canonically a fibration over $B$. The fibration so-produced is frequently called the \emph{Grothendieck construction} of the associated pseudo-functor; see \cite[A1.1.7, B1.3.1]{MR1953060} for the discrete case, when the pseudo-functor takes values in $\Set$, and \cite[pp. 1-104]{MR2222646} for applications to algebraic geometry, which provided the historical source of this definition.
\end{proof}

\begin{rmk}[Fibrations and indexed categories]
Let $\mathcal S$ be a category with finite limits, and in particular pullbacks. An \emph{indexed category} consists of a pseudofunctor $\underline{A} \colon \mathcal S^\text{op} \to \Cat$ such that each $\underline{A}^I := \underline{A}(I)$ has a distinguished class of isomorphisms called \emph{canonical}. The coherence conditions for $\underline{A}$ to be a pseudofunctor are specified in terms of these canonical isomorphisms, and an entire theory of indexed categories can be developed with respect to the `indexing base' $\mathcal S$ (there is a 2-category $\mathcal S\text{-Ind}$ of such structures, there is a notion of indexed adjunction, etc.\dots).

The theories of indexed categories and of fibrations over $\Cat$ are `essentially equivalent' in the sense that the Grothendieck construction allows to pass back and forth between the two notions.

See \cite{johnstone1978indexed} for a more detailed account of the theory of indexed categories, and in particular \cite{pare1978abstract} for an introduction on the subject; the notion of indexed category is almost always referred to the case where the indexing base is an elementary topos.
\end{rmk}

Fibrations enjoy similar stability properties to their topological analogs.

\begin{thm}\label{catstabthm} Fibrations are closed under composition and pullback along arbitrary functors.
\end{thm}
\begin{proof} See \cite[3.1]{grayfibred}.
\end{proof}

\begin{rmk}
There is no analog of Proposition \ref{thm:dfib-ofs} whose right class is the class of fibrations for the rather pedestrian reason that the fibrations introduced in Definition \ref{defn:1-fib} are not closed under retracts. There is however an \emph{algebraic} weak factorization system whose \emph{algebraic} right maps are cloven fibrations. See \cite[Example 29(ii)]{BourkeGarner:AWFS1}.
\end{rmk}

Before giving examples, we mention the dual notion.
\begin{defn}
 A functor $p\colon E \ra B$ is an \emph{opfibration} if $p \colon E^{\op} \ra B^{\op}$ is a fibration. A functor $p \colon E \ra B$ that is both a fibration and an opfibration is called a \emph{bifibration}.
\end{defn}
The proof of the following lemma is left as an exercise.
\begin{lem}\label{lem:bifib-adjoint}
 A fibration $p \colon E \ra B$ is also an opfibration if and only if each functor $f^* \colon E_b \ra E_{b'}$ has a left adjoint $f_!$.
\end{lem}

Finally, some examples:

\begin{ex} \quad
\begin{enumroman}
\item The codomain functor $C^{\2} \ra C$ is an opfibration that is a fibration iff $C$ has pullbacks. (Hence the name ``cartesian''.)
\item The domain functor $C^\2 \ra C$ is a fibration that is an opfibration iff $C$ has pushouts.
\item There is a functor $\Ring^\op \to \Cat$ which carries a ring $R$ to the category ${}_R\Mod$ of left $R$-modules and a ring homomorphism $f \colon R \to S$, to the restriction of scalars functor $f^* \colon {}_S\Mod \to {}_R\Mod$. As these functors admit left adjoints $f_!$, given by extension of scalars, by Lemma \ref{lem:bifib-adjoint} the Grothendieck construction produces a bifibration $\Mod \to \Ring$, where the objects of $\Mod$ are left modules over varying rings and a morphism over a ring homomorphism $f\colon R \to S$ can be understood as a homomorphism of $R$-modules, where the codomain $S$-module is restricted along $f$.
\item For any category $C$, the category of set-indexed families of objects of $C$ is a fibration over $\Set$ with the forgetful functor taking a family to its indexing set. The functors $f^*$ are given by reindexing and have left adjoints iff $C$ has small coproducts, and right adjoints iff $C$ has small products.\end{enumroman}
\end{ex}

We mention one final result which will motivate the definitions in Section \ref{2catsec}.

\begin{thm} A functor $p \colon E \ra B$ is a fibration if and only if the functor $[X,p] \colon [X,E] \ra [X,B]$ is a fibration for every category $X$.
\end{thm}
\begin{proof}
See \cite[3.6]{grayfibred}.
\end{proof}

\subsection{Two-sided discrete fibrations} Finally, we reach the variant of interest.

\begin{defn}\label{cattwodefn}
A \emph{two-sided discrete fibration} is a span $A \sr{q}{\la} E \sr{p}{\ra} B$ such that
\begin{enumroman}
\item each $qe \ra a'$ in $A$ has a unique lift in $E$ that has domain $e$ and lies in the fiber over $pe$
\item each $b' \ra pe$ in $B$ has a unique lift in $E$ that has codomain $e$ and lies in the fiber over $qe$
\item for each $f \colon e \ra e'$ in $E$ the codomain of the lift of $qf$ equals the domain of the lift of $pf$ and their composite is $f$.
\end{enumroman}
The situation is depicted in Figure \ref{fig:fibrs}, where in the lower right corner the ``vertical-cartesian'' factorization of an arrow $f$ is depicted.
\end{defn}

Let $\DFib(A,B)$ denote the full subcategory of $\Span(A,B)$ on the two-sided discrete fibrations.
\begin{figure}

\begin{tikzpicture}[scale=.6]
\begin{scope}
\fill[gray!15] (0,0) ellipse (3cm and 2cm);
\fill (1.5,1) circle (2pt) node (vp0) {};
\fill (1.5,-.25) circle (2pt) node (vp1) {};
\fill (0,-1) circle (2pt) node (vq1) {};
\fill (-1.25,-1) circle (2pt) node (vq0) {};
\draw[->] (vp0) -- (vp1);
\draw[->] (vq0) -- (vq1);
\node[draw,dashed,fit=(vp0) (vp1)] (U) {};
\node[draw,dashed,fit=(vq0) (vq1)] (V) {};
\node[black!75] at (-.75,.75) {\huge$\boldsymbol E$};
\end{scope}

\begin{scope}[xshift=9cm]
\fill[gray!15] (0,0) ellipse (3cm and 2cm);
\fill (-1.5,1) circle (2pt) node (vp0) {};
\fill (-1.5,-.25) circle (2pt) node[below] (vp1) {$p$};

\fill (0,-1) circle (2pt) node (rightid) {};
\draw[->, shorten >=3pt] (vp0) -- (vp1);
\node[draw,dashed,fit=(vp0) (vp1)] (A) {};
\node[draw,dashed,fit=(rightid)] (B) {};
\node[black!75] at (.75,.75) {\huge$\boldsymbol B$};
\end{scope}

\begin{scope}[yshift=-7cm]
\fill[gray!15] (0,0) ellipse (3cm and 2cm);
\fill (0,1) circle (2pt) node (vq1) {};
\fill (-1.25,1) circle (2pt) node[left] (vq0) {$q$};
\fill (1.5,-.5) circle (2pt) node (lowid) {};
\draw[->, shorten <=4pt] (vq0) -- (vq1);
\node[draw,dashed,fit=(vq0) (vq1)] (C) {};
\node[draw,dashed,fit=(lowid),red] (D) {};
\node[black!75] at (-.75,-.75) {\huge$\boldsymbol A$};
\end{scope}
\draw[dashed,->,-latex,thick,blue] (U) -- (U |- D.north) node[midway,left] {$q$};
\draw[dashed,->,-latex,thick,red] (U) -- (U -| A.west) node[midway,above] {$p$};
\draw[dashed,->,-latex,thick,red] (V) -- (V -| B.west) node[midway,above] {$p$};
\draw[dashed,->,-latex,thick,blue] (V) -- (V |- C.north) node[midway,left] {$q$};

\begin{scope}[xshift=6cm,yshift=-5cm]
\fill (0,0) circle (2pt) node (f0) {};
\fill (1,-1) circle (2pt) node (f1) {};
\fill (f0 -| f1) circle (2pt) node (ff) {};
\draw[->] (f0) -- (ff);
\draw[->] (ff) -- (f1);
\end{scope}

\begin{scope}[xshift=11cm,yshift=-5cm]
\fill (0,0) circle (2pt) node (pf0) {};
\fill (1,-1) circle (2pt) node (pf1) {};
\fill (pf0 -| pf1) circle (2pt) node (pff) {};
\draw[double] (pf0) -- (pff);
\draw[->] (pff) -- (pf1);
\end{scope}

\begin{scope}[xshift=6cm,yshift=-8cm]
\fill (0,0) circle (2pt) node (qf0) {};
\fill (1,-1) circle (2pt) node (qf1) {};
\fill (qf0 -| qf1) circle (2pt) node (qff) {};
\draw[->] (qf0) -- (qff);
\draw[double] (qff) -- (qf1);
\end{scope}
\node[draw,dashed,fit=(f0) (ff),blue] (box1) {};
\node[draw,dashed,fit=(f1) (ff),red] (box2) {};
\node[draw,dashed,fit=(pf0) (pff),blue] (pbox1) {};
\node[draw,dashed,fit=(pf1) (pff),red] (pbox2) {};
\node[draw,dashed,fit=(qf0) (qff),blue] (qbox1) {};
\node[draw,dashed,fit=(qf1) (qff),red] (qbox2) {};
\draw[dashed,thick,->,-latex,red] (box1) -- (pbox1);
\draw[dashed,thick,->,-latex,blue] (box1) -- (qbox1);
\draw[dashed,thick,->,-latex,red] (box2) -- (pbox2);
\draw[dashed,thick,->,-latex,blue] (box2) -- (qbox2);
\end{tikzpicture}

\caption{The cartesian-vertical factorization of a morphism in a span: a fibration determines a factorization system on $E$ in the sense that every $f : e\to e'$ in $E$ admits a factorization as a $p$-vertical arrow followed by a $p$-cartesian arrow; dually, an opfibration determines a $q$-vertical, $q$-cocartesian factorization.}
\label{fig:fibrs}
\end{figure}
The definition of two-sided discrete fibration in fact doesn't add something new to the picture, as
\begin{thm} There exist equivalences of categories \[\DFib(A,B) \simeq [B^\op \times A, \Set] \simeq \DFib(B\times A^\op),\] pseudo-natural in $A$ and $B$.
\end{thm}
\begin{proof} Given a two-sided discrete fibration $A \sr{q}{\la} E \sr{p}{\ra} B$, define $B^\op \times A \ra \Set$ by $(b,a) \mapsto E_{a,b}$, the objects in the fiber over $a$ and $b$. Given $g \colon b' \ra b$, the corresponding function $g^* \colon E_{a,b} \ra E_{a,b'}$ sends $e \in E_{a,b}$ to the domain of the unique lift of $g$ in the fiber over $a$ with codomain $e$; likewise, given $f \colon a \ra a'$ the corresponding $f_* \colon E_{a,b} \ra E_{a',b}$ sends $e$ to the codomain of the  unique lift of $f$ in the fiber over $b$ with domain $a'$.

Conversely, given $P\colon B^\op \times A \ra \Set$, let the objects of $E$ be triples $(b \in B, e \in P(b,a), a \in A, )$ and morphisms $(b, e, a) \ra (b',e', a')$ be pairs of arrows $f\colon a \ra a'$ in $A$ and $g\colon b \ra b'$ in $B$ such that $f_*(e) = g^*(e')$.\footnote{Note this isn't the \emph{collage} of $P$, a category living over the walking arrow $\2$, defined below. Rather it's the category of sections of this functor, with morphisms the natural transformations. See the $n$Lab discussion of two-sided fibrations.}
\end{proof}

Comma categories provide an important class of examples of two-sided discrete fibrations. In fact, in $\Cat$, they tell the whole story.

\begin{thm}\label{catcommathm} For any opspan $B \sr{f}{\ra} C \sr{g}{\la} A$, its comma category \[\xymatrix{ \comma{f}{g} \ar[d]_{c} \ar[r]^d & B \ar[d]^f \\ A \ar[r]_g \ar@{}[ur]|{\Leftarrow} & C}\] is a two-sided discrete fibration $A \sr{c}{\la} \comma{f}{g} \sr{d}{\ra} B$. Furthermore, all two-sided discrete fibrations in $\Cat$ arise this way.
\end{thm}
\begin{proof} See \cite[14]{streetfibrationsyoneda}.
\end{proof}

Finally, for completeness, we give the definition of two-sided fibrations, which aren't required to be discrete.

\begin{defn} A span $A \sr{q}{\la} E \sr{p}{\ra} B$ is a \emph{two-sided fibration} if \begin{enumroman} \item Any $g\colon qe \ra a \in A$ has an opcartesian lift with domain $e$ that lies in the fiber over the identity at $pe$. \item Any $f \colon b \ra pe$ has a cartesian lift with codomain $e$ that lies in the fiber over the identity at $qe$. \item Given a cartesian lift $f^*e \ra e$ of $f$ and an opcartesian lift $e \ra g_!e$ of $g$, as above, the composite \[ f^*e \ra e \ra g_!e\] lies over both $f$ and $g$. If $f^*e \ra g_!f^*e$ and $f^*g_!e \ra g_!e$ denote its opcartesian and cartesian lifts, then the canonical comparison $g_!f^*e \ra f^*g_!e$ induced by the universal property of either of these must be an isomorphism. \end{enumroman}
\end{defn}

Two-sided fibrations determine pseudo-functors $\B^\op \times \A \rightsquigarrow \Cat$.

config: arxiv


TITLE: Find the extremal functions $y(x)$ of the integral $\int_0^1(y^2-(y')^2)dx$.
QUESTION [0 upvotes]: We have to find the extremal functions $y(x)$ of the integral $\int_0^1(y^2-(y')^2)dx$.
MY TRY:I used the formula $\frac{\partial F}{\partial y} - \frac{d}{dx}(\frac{\partial F}{\partial y'}) = 0$ and finally got $(y')^2+y^2=c$ but i could not get the ans as $y=A\cos x+B\sin x$.Thank you.

REPLY [1 votes]: The differential equation you get is correct. Let's define $k^2:=c$, then we have
$$(y')^2+y^2=k^2\implies y'=\pm\sqrt{k^2-y^2}$$
This is a seperable equation, thus we have
$$\pm\int\frac{dy}{\sqrt{k^2-y^2}}=x+A$$
The integral on the left gives you an inverse sine function for the positive sign and an inverse cosine function for the negative sign. I'm going to go with the positive sign here, the negative is completely analogous.
\begin{align}
\int\frac{dy}{\sqrt{k^2-y^2}}&=\frac{1}{k}\int\frac{dy}{\sqrt{1-\frac{y^2}
{k^2}}}\\
&=\int\frac{du}{\sqrt{1-u^2}}\\
&=\arcsin(u)\\
&=\arcsin\left(\frac{y}{k}\right)
\end{align}
Thus, we have
$$y(x) = k\sin(x+A)$$
This can be rewritten in the form
$$y(x) = C\sin(x)+D\cos(x)$$
using trigonometric identities.
When going with the negative sign, you get an inverse cosine function. You can then rewrite it in the same way using trig identities to arrive the general form that you seek.


TITLE: Nonparametric Hermite cubic to Bezier Curve
QUESTION [0 upvotes]: I have a Hermite cubic in the form of the standard cubic equation of $y=ax^3+bx^2+cx+d$, and this works well for my interpolation needs, but now I want to create Bezier curves from the Hermite cubics. I struggle to find a way to transform a Hermite cubic into a Bezier curve.
I've followed Joshua Barczak's blog about transforming a Hermite curve into a Bezier curve, and this seems to work, but I only end up with Bezier curves that are lines after doing this for x and y. For example, a
Hermite cubic given (0, 0) and (1, 1) with $f'(0)=0$ and $f'(1)=0$ aka $y=-2x^3+3x^2$ transforms into this green curve. Another example would be a Hermite cubic given (-1, 0) and (1, 2) with $f'(-1)=0$ and $f'(1)=0$ or the equation $-0.5x^3+1.5x+1$, which is also a line once transformed.
I believe that I am misunderstanding either the Hermite control points, since I do not use a parametrized function, or that I am incorrectly applying Barczak's method, but it seems like it is simply multiplying the inverse Bezier matrix by the Hermite basis matrix by the Hermite control matrix to find the Bezier control matrix.
You can see the actual desmos graph here.

REPLY [2 votes]: Suppose the start and end-points of the cubic are $P_0 = (x_0, y_0)$ and $P_1 = (x_1,y_1)$, and the starting and ending slopes (first derivatives) are $d_0$ and $d_1$.
Then, to express this as a 2D parametric cubic Bezier curve, the control points you use are:
$$
(x_0, y_0) \\
\big(\; x_0 + \tfrac13(x_1 - x_0) \; , \; y_0 + \tfrac13d_0(x_1 - x_0) \;\big)  \\
\big(\; x_1 - \tfrac13(x_1 - x_0) \; , \; y_1 - \tfrac13d_1(x_1 - x_0) \;\big) \\
(x_1, y_1)
$$


TITLE: Expected Value for Heads for Unknown Weighted Coin Given Head First Flip
QUESTION [2 upvotes]: This is a combinatorics problem, and I think it involves expected values and conditional probability, but I don't know how to use them:
"A bag contains an infinite number of coins whose probabilities of heads on any given flip are uniformly and continuously distributed between 0 and 1. A coin is drawn at random from this bag. Given that the first flip is a head, determine the probability that the next flip is also a head."
The answer is 2/3, but could someone please explain why?

REPLY [1 votes]: Let random variable $P_H$ be the bias towards heads of the coin you picked.
$$\begin{align}\mathsf P(H_2\mid H_1) =&~ \dfrac{\mathsf P(H_1\cap H_2)}{\mathsf P(H_1)} & \text{by definition} \\[1ex] =&~ \dfrac{\mathsf E(\mathsf P(H_1\cap H_2\mid P_H))}{\mathsf E(\mathsf P(H_1\mid P_H))} & \text{Law of Total Probability} \\[1ex] =&~ \dfrac{\mathsf E({P_H}^2)}{\mathsf E(P_H)} \\[1ex] =&~ \dfrac{\int_0^1 p^2\operatorname d p}{\int_0^1 p\operatorname d p} & P_H\sim\mathcal U[0;1]\\[1ex] =&~ \dfrac{\tfrac 13(1^3-0^3)}{\tfrac 1 2(1^2-0^2)}\\[1ex] =&~\dfrac 2 3\end{align}$$