Fibered products in $\mathsf {Set}$

I’m just starting to work through Aluffi, and one question asks the reader to define fibered products (and coproducts) in the category of sets and functions. I’m just looking to check that I have the fibered products right before I move on to the fibered coproducts.

Let $\alpha\colon A\to C$ and let $\beta\colon B\to C$. Then the fibered product of $\alpha$ and $\beta$ is (I think), the set product $P:=\alpha^{-1}[\beta[B]]\times\beta^{-1}[\alpha[A]]$ together with the usual projections $\pi_A$ and $\pi_B$.

Proof (I hope):

Let $f\colon Z\to A$ and $g\colon Z\to B$ so that $\alpha f=\beta g$. Suppose that for some $\sigma\colon Z\to P$, $f=\pi_A \sigma$ and $g=\pi_B \sigma$. Then for each $z\in Z$, $\pi_A(\sigma(z))=f(z)$ and $\pi_B(\sigma(z))=g(z)$, so for all $z\in Z$, $\sigma(z)=(f(z),g(z))$ (so $\sigma$ is unique).

Indeed, this assignment works: if $z\in Z$, then $\alpha(f(z))=\beta(g(z))\in \beta[B]$, so surely $f(z)\in \alpha^{-1}[\beta[B]]$, and symmetrically a similar thing holds for $g$, so $(f(z),g(z))\in P$. That $\pi_A\sigma=f$ and $\pi_B\sigma=g$ is then immediate.

Update

As the answers indicate, that was wrong. Can someone tell me if the answer I give below is correct?

Solutions Collecting From Web of "Fibered products in $\mathsf {Set}$"

Your definition is not quite right, because with it, you need not have $\alpha\circ \pi_A=\beta\circ\pi_B$. For example, let $A=\{1,2\}$, $B=\{1,2\}$, and $C=\{1,2,3\}$, let $\alpha$ be the inclusion, and let $\beta$ send $1$ to $2$ and $2$ to $1$. Then $(2,2)$ is an element of your set, but applying $\pi_A$ and then $\alpha$ gives $2$, while applying $\pi_B$ and then $\beta$ gives $1$. The fiber product must be equipped with projections $\pi_A$ and $\pi_B$ satisfying $\alpha\circ\pi_A=\beta\circ\pi_B$.

Responding to Keenan Kidwell’s helpful criticism and Ma Ming’s perhaps-overly-generous hint, I try again:

Let $P=\{(a,b):\alpha(a)=\beta(b)\}$ and again use the canonical projections. Define $\sigma$ the same way (again, there is no other choice). Now if $z\in Z$, then $\alpha(f(z))=\beta(g(z))$, so $(f(z),g(z))\in P$ and everything works out as it should.

This is wrong.

Let $A=B=C$, $\alpha=\beta=id$. Then the fiber product should be the diagonal in $A\times A$.