Let $Z$ be the subspace of $\Bbb R^2$ given by $$Z=\bigg(\{0\}\times[-1,1]\bigg)\bigcup\bigg\{(x,y):0<x\leq 1,y=\sin\bigg(\frac{\pi}{x}\bigg)\bigg\}.$$ Next consider the quotient space, $$X=\frac{Z}{\{(0,0),(1,0)\}}.$$
I want to show, $X$ has trivial fundamental group. Here is my approach.
Since $X$ is path connected, it is enough to show, $\pi_1(X,[(0,0)])$ is trivial. So let $f:[0,1]\to X$ be a loop based at $[(0,0)]$. Since $[0,1]$ is compact and continuous image of a compact set is compact we have, $f([0,1])$ is a compact subset of $X$. Hence we have a $1>\delta>0$ such that, image of $f$ is contained in $X_{\delta}$, where $$X_{\delta}=\frac{\big(\{0\}\times[-1,1]\big)\bigcup\big\{(x,y):\delta\leq x\leq 1,y=\sin\big(\frac{\pi}{x}\big)\big\}}{\{(0,0),(1,0)\}}.$$ Now, $X_{\delta}$ is contractible space. So $f:[0,1]\to X_{\delta}$ is homotopically equivalent to constant loop. Now for the inclusion map $i:X_{\delta}\hookrightarrow X$ we have the induced inclusion map, $i_*:\pi_1(X_{\delta},[(0,0)])\hookrightarrow \pi_1(X,[(0,0)])$. Since $\big[f:[0,1]\to X_{\delta}\big]\in \pi_1(X_{\delta},[(0,0)])$ is a trivial element, so $\big[f:[0,1]\to X\big]\in \pi_1(X,[(0,0)])$ is also a trivial element.
My question is, am I right? If, not where is my fault. Another question is, is $X_{\delta}$ a contractible space? Thanks.
It's not true that any compact subset of $X$ is contained in an $X_\delta$, in fact $X$ is itself compact ($Z$ is compact as the closure of a bounded set in $\mathbb R^2$, therefore $X$ is compact as well, as a quotient of a compact space) : that was an unjustified claim and in fact it was wrong.
What will make $X_\delta$ appear is path connectedness, not compactness.
Then this is not a "fault", but you did not justify the claim that $X_\delta$ is contractible, although it should not be too hard to write down explicitly a contracting homotopy.