$f$ continuous $\Leftrightarrow f\circ p$ continuous implies $p$ quotient map Let $X,Y,Z$ be topological spaces.
Let $p:X\rightarrow Y$ be a continuous surjection. Let $f:Y\rightarrow Z$ be continuous if and only if $f\circ p:X\rightarrow Z$ is continuous.
I want to prove that this makes $p$ a quotient map. 
My thoughts:
Since $p$ is a continuous surjection, all I need is for $p$ to also be open.
If I can show that $p^{-1}$ exists and is continuous, then $p$ must be open, and therefore a quotient map.
Since $p$ is surjective, I know that $p$ at least has a right inverse, so some function $g$ exists such that $p\circ g = Id_Y$.
I don't know how to proceed, however. Am I on the right track?
 A: So $p:X \to Y$ obeys the property that 

for all functions $g: Y \to Z$, $g$ is continuous iff $g \circ p$ is continuous.

Then suppose that $U$ is a subset of $Y$ that satisfies $p^{-1}[U]$ is open in $X$. Then define $Z = \{0,1\}$ with the topology $\{\{0\}, \emptyset, Z\}$ (the Sierpinski space) and define $g: Y \to Z$ by $g(y) = 0$ if $y \in U$, $g(y) = 1$ otherwise. Then $(g \circ p)^{-1}[\{0\}] = p^{-1}[g^{-1}[\{0\}]] = p^{-1}[U]$ is open, and as this $\{0\}$ the only non-trivial open set of $Z$, $g \circ p$ is continuous (the inverse image of $Z$ is just $X$, and of $\emptyset$ is $\emptyset$ again, so these never have to be checked), and by the property of $p$ we know that $g$ is continuous, so $g^{-1}[\{0\}] = U$ is open in $Y$, as required.
On the other hand, if $U$ is open in $Y$ then the same function $g$ is continuous and so $g \circ p$ is continuous, which implies that $g^{-1}[U]= (g \circ p)^{-1}[\{0\}]$ is open in $X$. So $U$ open in $Y$ iff $p^{-1}[U]$ is open in $X$. This means by definition that $p$ is quotient. 
The last direction indeed follows directly if you assume $p$ is continuous. I wanted to show that the continuity of $p$ even follows from the “composition property”. 
A: I assume you want the property to hold for all spaces $Z$. In this case, pick $Z = Y$ as sets, endowed with the quotient topology for $p$. Let $f:Y \to Z$ be the identity map. We will show that $f$ is a homeomorphism, and hence that $Y$ also has the quotient topology.
First, $\tilde p =f \circ p$ is continuous because $p$ is, hence by the universal property $f$ is also continuous.
Next, we may factor the continuous map $p$ as $$p = f^{-1} \circ f \circ p =f^{-1} \circ \tilde p,$$
and by the corresponding universal property for for $\tilde p$, this means that $f^{-1}$ is continuous.
A: This follows from univeral property arguments.  If an object satisfies the same universal property as a quotient, product, coproduct etc. then it is that quotient, product, coproduct etc.  You can give a much shorter proof of this without universal property arguments, but if you become familiar with such arguments, then problems like this can be solved in a mechanical way without doing much thinking.
Lemma: Let $\pi: X \rightarrow S$ be a quotient map.  That is, $\pi$ is surjective, and $U$ is open in $S$ if and only if $\pi^{-1}U$ is open in $X$.  Then for any space $Z$, and any continuous map $g: X \rightarrow Z$ such that $\pi(x_1) = \pi(x_2)$ implies $g(x_1) = g(x_2)$, there is a unique continuous map $\bar{g}: S \rightarrow Z$ such that $g = \bar{g} \circ \pi$.
Proof: If we forget continuity and just worry about $\pi$ and $f$ as maps of sets, it's clear that there is a unique function $\bar{g}: S \rightarrow Z$ such that $g = \bar{g} \circ \pi$, namely for any $s \in S$, we find an $x \in X$ such that $\pi(x) = s$, and then define $\bar{g}(s) = g(x)$.  This is a well defined function which doesn't depend on the choice of $x$.  We just need to show that $\overline{g}$ is continuous.  
If $V \subseteq Z$ is open, we want to show that $\bar{g}^{-1}V$ is open in $S$.  This is true if and only if $\pi^{-1}\bar{g}^{-1}V$ is open in $X$.  But $\pi^{-1}\bar{g}^{-1}V = (\bar{g} \circ \pi)^{-1}V = g^{-1}V$, and $g$ is continuous, so it is open in $X$.  $\blacksquare$
Now let $p: X \rightarrow Y$ be your surjective continuous map.  We are supposing that for any continuous map $f: X \rightarrow Z$ such that $p(x_1) = p(x_2)$, there is a unique continuous map $\bar{f}: Y \rightarrow Z$ such that $\bar{f} \circ p = f$, and we want to show that $Y$ has the quotient topology.
Temporarily forget the existing topology on the set $Y$, and give this set the quotient topology with respect to the surjective function $p: X \rightarrow Y$.  Denote the set $Y$, together with the quotient topology, by the letter $S$.  Then $p: X \rightarrow S$ is a quotient map.  What you want to show then is that $S = Y$ (already they are equal as sets, but you want to show that they are the same topological space).  This amounts to showing that the identity function $S \rightarrow Y$ is a homeomorphism.
Since the quotient map $p: X \rightarrow S$ is by definition continuous, your hypothesis on $Y$ tells you that there must be a unique continuous map $j: Y \rightarrow S$ such that $p = j \circ p$ as maps $X \rightarrow S$.  As a map of sets, $j$ is obviously the identity map.  Thus the identity map $Y \rightarrow S$ is continuous.
On the other hand, the lemma tells you that $S$ satisfies the same property as $Y$: since $p: X \rightarrow Y$ is continuous, there must be a unique continuous map $i: S \rightarrow Y$ such that $p = p \circ i$ as maps $X \rightarrow Y$.  As a map of sets, $i$ is obviously the identity map.  Thus the identity map $S \rightarrow Y$ is continuous.
Since the identity function $S \rightarrow Y$ and its inverse are both continuous, this function is a homeomorphism, meaning $Y$ has the same topology as $S$, so $p: X \rightarrow Y$ is actually a quotient map.
