Correctness proof: 2-approximation of greedy matching-algorithm
Let $M$ be a maximal matching in the graph $G$. Let $M'$ be the matching returned by our approximation algorithm (obviously this algorithm returns a valid matching). 

For all $e\in M'$ let $M_e\subseteq M$ be the set of edges in $M$ who have common vertices with $e$, meaning all $e_M\in M$ such that $e_M\cap e\neq\emptyset$. Obviously $\forall e\in M': |M_e|\le 2$, since at the worst, $e=(u,v)$ and both $u,v$ are matched to some other vertex in $M$.

Note that $M=\bigcup\limits_{e\in M'}M_e$. To see why, suppose for the purpose of contradiction that there exists $e\in M$ with no common vertices with any $e'\in M'$. This means that our algorithm could have added $e$ to $M'$, contradiction. So we have:

$|M|\le\sum\limits_{e\in M'}|M_e|\le 2|M'|$.