Let $X$ be a path connected space and $f, g : I \to X$ be two paths from $p$ to $q$. Show $f\sim g$ iff $f \cdot \bar{g} \sim c_p$ 
Let $X$ be a path connected space and $f, g : I \to X$ be two paths from $p$ to $q$. Show $f\sim g$ iff $f \cdot \bar{g} \sim c_p$

Now there is an answer proving the forward implication here : https://math.stackexchange.com/a/1054648/266135
The answer seems correct to me, but it feels a bit as if the argument was pulled out of thin air.
Intuitively I can see that $f \cdot \bar{g} \sim c_p$ means that the path from $p$ to $q$ and back to $p$ can be shrunk (or continuously deformed) into a point.
Is there a simpler way to define such a homotopy?
 A: Many times the "thin air" out of which one of these homotopy formulas has been pulled is actually rather thick: the mysterious formula actually has concrete origins in the geometry of squares. 
I'm going to do just one direction, namely the proof that $f \cdot \bar g \sim c_p \implies f \sim g$, and I'll do it by a "formula free" method, leaving you to derive a formula which does what this method suggests.
We have $p = f(0)=g(0)$ and $q=f(1)=g(1)$.
Suppose first that $f \cdot \bar g \sim c_p$ and so there exists a continuous function $H_0 : [0,1] \times [0,1] \to X$ having the properties $H_0(s,0)=f(2s)$ for $0 \le s \le \frac{1}{2}$, $H_0(s,0)=g(2s-1)$ for $\frac{1}{2} \le s \le 1$, and on each of the other three sides of the square $[0,1]\times[0,1]$ the restriction of the functio $H_0$ is a constant with value $p$. Notice that $H(\frac{1}{2},0)=q$.
Let's pause and examine what $H_0$ looks like when restricted to the boundary of the square $[0,1] \times [0,1]$. We can parameterize that boundary as a single path $\gamma(u)$ ($u \in [0,1]$), starting from the lower left corner $(0,0)$ and going around in counterclockwise order: the parameterization will be a concatenation of four paths, first the path from $(0,0)$ to $(1,0)$, then from $(1,0)$ to $(1,1)$, and so on. Notice that the composed path $H_0 \circ \gamma : [0,1] \to X$ is a parameterization of a concatenation of three paths in $X$, namely $f \cdot  \bar g \cdot c_p$. 
Now let's think about our goal, which is to construct another homotopy
$$H_1 : [0,1] \to [0,1]
$$
such that $H_1(s,0) = f(s)$, $H_1(s,1)=g(s)$, $H_1(0,t)=p$, $H_1(1,t)=q$. This homotopy, if it existed, could be restricted to its boundary in a similar fashion that $H_0$ was restricted, resulting in a parameterization of a concatenation of four paths in $X$, namely $f \cdot c_q \cdot \bar g \cdot c_p$. That looks pretty promising: all we are missing is the $c_q$ term. How can we get it?
Answer: we can get that $c_q$ term by defining $H_1$ to be a composition of the form
$$H_1 : [0,1] \times [0,1] \xrightarrow{\psi} [0,1] \times [0,1] \xrightarrow{H_0} X
$$
where the continuous function $\psi$ has the following properties:


*

*$\psi$ restricted to $[0,1] \times \{0\}$ is the constant speed map onto $[0,\frac{1}{2}] \times \{0\}$ taking $(0,0)$ to $(0,0)$ and taking $(1,0)$ to $(\frac{1}{2},0)$ --- composing with $H_0$ then gives us $f$.

*$\psi$ restricted to $\{1\} \times [0,1]$ is the constant map with value $(\frac{1}{2},0)$ --- composing with $H_0$ then gives us $c_q$.

*$\psi$ restricted to $[0,1] \times \{1\}$ is the constant speed map onto $[\frac{1}{2},1] \times \{0\}$ taking $(1,1)$ to $(\frac{1}{2},0)$ and taking $(0,1)$ to $(1,0)$ --- composing with $H_0$ then gives us $\bar g$ (when going around counterclockwise, that is)

*$\psi$ restricted to the $\{0\} \times [0,1]$ is a homeomorphism onto the union of three sides 
$$(\{0\} \times[0,1]) \cup ([0,1] \times \{1\}) \cup (\{1\} \times [0,1])
$$ 
taking $(0,0)$ to $(0,0)$ and $(0,1)$ to $(1,0)$.


So, all that remains is to write down a formula for $\psi$ which has these four properties. 
At this point I will stop, and let you ponder the geometry of squares and how to write down the desired formula for $\psi$; composing with $H_0$ will then give you the desired formula for $H_1$. You might not get the same formula as in the link you provided, but that's okay, there can be many different homotopies from $f \cdot \bar g$ to $c_p$.
Or, you can look at the formula in the link you provided in your question, and try to back-engineer to get a formula for $\psi$, and then ponder the geometry of that formula. 
Either way, this should give you a detailed look at the method behind these "thin air" formulas, and hopefully help you to construct your own formulas whose geometric origins you can then hide just like a textbook writer.
