Gluing cylinders together I was trying to glue two cylinders and then show that the resulting space is a manifold. Here is the first of my attempts:
The cylinders I denote $C_0 = S^1 \times [0,1]$ and $C_1 = S^1 \times [0,1]$. Let $T \subseteq R^3$ be the surface 
$$x = \cos \theta (R + r \cos \phi),$$ 
$$y = \sin \theta ( R + r \cos \phi) ,$$
$$ z = r \sin \phi$$ 
with $\theta, \phi \in [0,2\pi]$ and $S^1 \times [0,1]$ be $(\cos \theta , \sin \theta , \phi) $ with $\theta \in [0,2\pi]$, $\phi \in [0, \pi / 2]$. 
Let $g: C_0\times \{0\} \cup C_1 \times \{1\} \to T$ be 
$$(\cos \theta, \sin \theta , \phi , n ) \to (\cos ( \pi n + 2\phi)(R+r\cos \theta), \sin (\pi n + 2 \phi)(R + r \cos \theta), r \sin \theta)$$
Then on the disjoint union $C_0 \times \{0\} \cup C_1 \times \{1\}$ I define the equivalence relation $$(\cos s_1, \sin s_1, x_1, n') \sim (\cos s_0, \sin s_0, x_0,n)$$ $$\iff$$ 
$$ ((s_1 = s_0) \land (x_1 = x_0) \land (n=n')) \lor $$
$$ ((s_1 = s_0) \land (x_1 =  0 \land x_0 = \pi / 2) \land (n=0 \land n'=1)) \lor $$
$$((s_1 = s_0) \land (x_1 =  \pi / 2 \land x_0 = 0) \land (n=0 \land n'=1)).  $$
Let $T$ be the surface of the torus in $\mathbb R^3$ and $f: X /\sim \to T$, $[x] \mapsto g(x)$.
Then $f$ is bijective continous and open. 
Therefore $T$ and $X/\sim$ are homeomorphic and therefore $X/\sim$ is a manifold.
Does it work like this? And how to show $f$ is open and continous? I tried but failed. Thank you for correcting me.
 A: If you want to prove that the gluing together of two cylinders is a manifold, you don't need to actually write too many things explicitly in the form of formulas. Even though the question doesn't explicitly state this, I take it from what you tried to do that the gluing occurs along the two circles $S^1\times\{0\}$ and along the circles $S^1\times\{1\}$.
To show that the result is a manifold, you don't explicitly need to know it is a torus (it is useful to realise this, but you won't need it). So, what do you do? First you describe the gluing process as $T=C_0\coprod C_1/\sim$, where $\sim$ identifies all relevant circles. You can do this as you did, but the same result can be obtained by only using two coordinates: one for the height, one for the angle.
When is a topological space a manifold? When it is locally homeomorphic to $\mathbb{R}^n$, in this case with $n=2$. So, this is what we need to show and we proceed by using the quotient topology on $T$: a set is open in $T$ if its preimage under the projection $\pi: C_0\coprod C_1\to T$ is open, i.e. if it is the disjoint union of an open in $C_0$ and one in $C_1$.
We now choose a point $p$ in $T$ and notice that there are two options:
1) The point `comes from' an interior point in one of the $C_i$, say $C_0$. In that case, the point in $C_0$ has an open neighbourhood $U$ away from the boundary of $C_0$. Moreover, this neighbourhood is a homeomorphism to an open part of $\mathbb{R}^2$. This neighbourhood is an open set in $T$ as well, so gives a local homeomorphism around $p$.
2) The point $p$ comes from the identified boundary points of the cylinders. In this case things get a bit more difficult. We need to find open sets $U_0$, $U_1$ in $C_0$, resp. $C_1$ that correspond on the boundary. There exists homeomorphisms of $U_0$ to an open part of $\mathbb{R}\times\mathbb{R}_{\leq0}$ and of $U_1$ to an open part of $\mathbb{R}\times\mathbb{R}_{\geq0}$. These can be put together to form an open part of $\mathbb{R}^2$, homeomorphic to $\pi(U_0\coprod U_1)$.
Parts 1 and 2 together show that local homeomorphisms to $\mathbb{R}^2$ exist and that the glued together cylinders form a manifold. It is however used that cylinders are manifolds with boundary. If you don't know this yet, you could more or less do the same to prove this, gluing together two sides of $[0,1]^2$.
A: Here is my work (with explicit formulas of imbeddings):
Let $$ \left ( \begin{array}{c} \cos \theta ( R + r \cos \varphi) \\ \sin \theta ( R + r \cos \varphi ) \\ r \sin \varphi \end{array} \right )$$ where $\theta, \varphi \in [0, 2 \pi]$ be a parametrization of the torus $T \subseteq \mathbb R^3$.
Let $(\cos a, \sin a , b ) $ where $a \in [0,2\pi], b \in [0,\pi / 2]$ be a parametrization of the cylinder $S^1 \times [0,1]$. 
On $X = C_0 \sqcup C_1 = \{ (\cos a , \sin a, b , n ) \mid a \in [0,2\pi], b \in [0,\pi / 2], n \in \{0,1\}\}$ define
$$ (\cos a, \sin a, b, n) \sim (\cos a' , \sin a', b', n') \iff 
((a = a') \land (b=b') \land (n=n')) \lor  
((a =a') \land (b=\pi/2) \land b'=0 \land (n=0) \land (n'=1)) \lor
((a =a') \land (b=0) \land b'=\pi/2 \land (n=0) \land (n'=1))$$
Let $f: C_0 \sqcup C_1 \to T$ be the map 
$$ (\cos a , \sin a, b, n) \mapsto \left ( \begin{array}{c} \cos ( \pi n + 2 b)(R + r \cos a) \\
\sin (\pi n + 2 b)(R + r \cos a) \\ r \sin a  \end{array} \right )$$
and define $g: X/\sim \to T$ as $[x] \mapsto f(x)$.
Here $g$ is (1) welldefined, (2) injective (3) surjective, (4) continous and (5) open:
(1) welldefined: Assume $[x]=[y]$ and without loss of generality, $x \in C_0$. For $x \neq y$ this happens in two cases: either 
$$ x = (\cos a, \sin a, 0,0) , y = (\cos a, \sin a, \pi / 2, 1)$$ or
$$ x = (\cos a, \sin a, \pi / 2,0) , y = (\cos a, \sin a, 0, 1)$$
In the first case, 
$$ g([x])=f(x) = \left ( \begin{array}{c} \cos ( \pi \cdot 0 + 2 \cdot 0)(R + r \cos a) \\
\sin (\pi \cdot 0 + 2 \cdot 0)(R + r \cos a) \\ r \sin a  \end{array} \right ) = 
\left ( \begin{array}{c} \cos ( \pi \cdot 1 + 2 \cdot \pi / 2)(R + r \cos a) \\ 
\sin (\pi \cdot 1 + 2 \cdot \pi / 2)(R + r \cos a) \\ r \sin a  \end{array} \right ) = g([y])$$
Similarly in the second case. Hence $g$ is welldefined.
(2) $g$ is injective: Assume $g([x]) = g([y])$ where $x = (\cos \theta_x, \sin \theta_x, \varphi_x,n_x)$ and $y = (\cos \theta_y, \sin \theta_y, \varphi_y,n_y)$. Then $r \sin \theta_x = r \sin \theta_y$ hence $\theta_x = \theta_y$. From this it follows that  $\cos(\pi n_x + 2 \varphi_x ) = \cos(\pi n_y + 2 \varphi_y ) $ and $\sin(\pi n_x + 2 \varphi_x ) = \sin(\pi n_y + 2 \varphi_y ) $. This implies $\pi n_y + 2 \varphi_y  = \pi n_x + 2 \varphi_x $. If $n_x = n_y$ it follows that $\varphi_x = \varphi_y$. If $n_x \neq n_y$, without loss of generality assume $n_x = 0$ and $n_y = 1$. Then $\pi + 2 \varphi_y = 2 \varphi_x$. Since $\varphi_x, \varphi_y \in [0, \pi / 2]$ this implies that $\varphi_y = 0$ and $\varphi_x = \pi / 2$. But then also $[x]=[y]$.
(3) $g$ is surjective: Let $$y =  \left ( \begin{array}{c} \cos ( \pi n + 2 b)(R + r \cos a) \\
\sin (\pi n + 2 b)(R + r \cos a) \\ r \sin a  \end{array} \right ) \in T$$ then for $x =  (\cos a , \sin a, b, n)$, $g([x]) = y$.
(4) $g$ is continous: Let $q : X \to X/\sim$ be the quotient map. Then $q$ is open by the definition of the quotient topology. Hence $g = f \circ q^{-1}$ is continous as the concatenation of two continuous functions. 
(5) $g$ is open: $g = f \circ q^{-1}$ and $q$ is open and continous hence $g$ is open $\iff$ $g \circ q = f$ is.
Let $U$ in $X$ be open. Then $U = U_0 \sqcup U_1$ where $U_0, U_1 $ are open and $U_0 \subseteq S^1 \times [0,1] \times \{0\}$ and $U_1 \subseteq S^1 \times [0,1] \times \{1\}$. $f$ restricted to $U_0, U_1$ respectively is the identity map hence open. Then $f(U) = f(U_0) \cup f(U_1) $ is open. 
Therefore $g$ is a homeomorphism. 
