TITLE: How to exactly write down a proof formally (or how to bring the things I know together)?
QUESTION [5 upvotes]: I've always had trouble with this: I know everything I need to know but I can't connect everything I know in the way it's being wanted from me.
This is what I have to do:

Prove for $f : M → N$ the following statement.$f$ is surjective if and only if the following is true: If $g, h: N → L$ are any functions with $g ∘ f = h ∘ f$, then $g = h$ applies.

The thing is, I am pretty sure I know what they want from me, but I have no idea how to show it. This is what I know:

$f: x ∈ M → f(x) ∈ N$$g: f(x) ∈ N → g(f(x)) ∈ L$  $h: f(x) ∈ N → h(f(x))∈L$  and of course:  $f$  is surjective when: $∀y ∈ N ∃ x ∈ M : f(x) = y$

Pretty simple, but I don't know if it is necesary to write this down. I continue:

$f$ is surjective if: $g ∘ f = h ∘ f $$⇔ g(f(x)) = h(f(x))$$⇔g(y) = h(y)$ would this be enough prove about that $g = h$ part?

I'm not even sure if this is going to the right direction, because I'm afraid I don't even know if I know what I am doing.
I'm open to every kind of help, because this is something I want to apply to all the proves of this kind.

REPLY [3 votes]: You have to prove:
$$(f\mbox{ surjective})\Leftrightarrow(\forall (g,h)\in L^N\mbox{ s.t. }g\circ f=h\circ f,\space g=h)$$
Which actually means:
$$\left\{\begin{array}{cc}(f\mbox{ surjective})\Rightarrow(\forall (g,h)\in L^N\mbox{ s.t. }g\circ f=h\circ f,\space g=h) && (1) \\ (\forall (g,h)\in L^N\mbox{ s.t. }g\circ f=h\circ f,\space g=h) \Rightarrow (f\mbox{ surjective}) && (2)\end{array}\right.$$
What you wrote is actually already the proof of $(1)$ so you only need to prove $(2)$ now.
If you don't know how to put the pieces together, you should first write on a piece of paper the first line of the proof (what you start from), skip some lines and then write what you want to get to. In your case:
$$\begin{array}{cc}\forall (g,h)\in L^N\mbox{ s.t. }g\circ f=h\circ f,\space g=h \\ \Rightarrow\cdots \\ \Rightarrow\cdots \\ \Rightarrow\cdots\\ \Rightarrow f\mbox{ surjective}\end{array}$$
Now what you have to do is obviously try and fill in the $\cdots$.
To do this, try and write what the first line tells you and also try to write what the last line can come from.
Example:
$$\begin{array}{cc}\forall (g,h)\in L^N\mbox{ s.t. }g\circ f=h\circ f,\space g=h \\ \Rightarrow\forall y\in N,\space g(y)=h(y) \\ \Rightarrow\cdots \\ \Rightarrow\cdots \\ \Rightarrow\forall y\in N,\space\exists x\in M\mbox{ s.t. }f(x) = y \\ \Rightarrow f\mbox{ surjective}\end{array}$$
By doing this, eventually you'll narrow down the gap between the start and the end of your proof and it'll be easier for you !
Now use this to prove $(2)$ and tell us if you still have problems doing so ;)
Hints:

If you have something like for example $\forall (g,h)\in L^N\mbox{ s.t. }g\circ f=h\circ f,\space g=h$ in your first line you might want to write it this way:


Let $(g,h)\in L^N$ be two functions such that $g\circ f=h\circ f$
$$\begin{array}{cc}\Rightarrow g=h \\ \Rightarrow\cdots \\ \Rightarrow\cdots\end{array}$$

Or you could even skip the first line as such:

Let $(g,h)\in L^N$ be two functions such that $g\circ f=h\circ f$
$$\begin{array}{cc}\Rightarrow\cdots \\ \Rightarrow\cdots\end{array}$$

The idea is just to transform $\forall\cdots$ in something like "Let ... be" or "Denote ...". And to replace $\exists x\mbox{ s.t.} P$ by writing an explicit $x$ which will verify the property $P$. This way it's easier to write down your proofs, you have less to worry about.