Contractible spaces has trivial fundamental group. I have to prove the following: Show that if $X$ is contractible (the def. I have is that $I:X\rightarrow X$ the identity function is homotopic to the constant function $p$ for some $p\in X$), then its fundamental group is trivial. 
Here is my attempt: Since the space is contractible, it is path connected (every point will be contracted to a fixed point, then for any two arbitrary, take the path to the fixed point, and then walk backwards on the other path, this gives you a path between any two points), I can assume that $\pi_1(X,p)$ is such that $p$ is the contraction point (since in a path connected space, all the groups obtained at different origins are isomorphic), then, let $h$ be my homotopy between the identity and the constant map, so we have: 
$$
h(0,-)=I(-)
$$
$$
h(1,-)=p
$$were $I$ is the identity on $X$ and $p$ is the constant path. Let $\gamma\in \pi(X,p)$. I want to show $[\gamma]=[p]$, so I thought of this homotopy, $F:[0,1]^2\rightarrow X$ via: 
$$
F(t,s)=h(t,\gamma(s))
$$Then, $F(0,s)=h(0,\gamma(s))=I(\gamma(s))=\gamma(s)$, $F(1,s)=p$, and lastly $F(t,0)=F(t,1)=h(t,\gamma(0))=h(t,p)$. I do not know how to argue why $h(t,p)=p$ for a contraction to $p$. It might be that my $F$ is incorrect too. (Note that $F$ is clearly cts, since $h$ is and $\gamma$ is as well). 
 A: Your idea is correct, but the moving $p$ is detail to be taken care of. I like to fix bad homotopies by messing with the square, since the space is too complicated. Imagine starting at the bottom-right corner of the square. Then going backwards along the bottom is going along the path $\sigma(t)$ of the point $p$. That is, $\sigma(t) = h(t,p)$. If we then go up, this goes along our path $\gamma$, and finally we go along the top, tracing $\sigma$, in the forward direction. So your square seems to be a "weird homotopy" from $\sigma^{-1} \ast \gamma \ast \sigma$ to the constant path, with the former path along three of the sides instead of just one. However, I claim that a clever transformation $I^2 \rightarrow I^2$ can turn this "weird homotopy" you defined into an honest homotopy from $\sigma^{-1} \ast \gamma \ast \sigma$ to the constant path.
EDIT: You must, of course, then figure out how to move from this to the fact that $\gamma$ is homotopic to the constant path. For this, you will either apply a nice theorem or attempt another fudge map for your square.
A: If your space X is contractible by hypothesis then you have an homotopy equivalence between X and $\lbrace x_0 \rbrace $ (the space with only one point). Then it is not difficult to prove that the homotopy equivalence induce an isomorphism between the 2 fundamental groups.
maybe you are not "allowed" to use these results but according to me the best way to solve this kind of exercise is to find an easier homotopically equivalent space and work with it. About this, using CW structure and theorems can be very helpful.
if you need to show an explicit homotopy the other answer is good. This is just an example of another approach.
