Question about domain of a function My question is from Apostol's Vol. 1 One-variable calculus with introduction to linear algebra textbook.
Page 56. Exercise 6. Let $f$ be defined as follows: $f(x)=1$ for $0\le x\le1$; $f(x)=2$ for $1\lt x\le2$. The function is not defined if $x\lt0$ or if $x>2$.
$a)$ Draw the graph of $f$.
$b)$ Let $g(x)=f(2x).$ Describe the domain of $g$ and draw its graph.
$c)$ Let $h(x)=f(x-2).$ Describe the domain of $h$ and draw its graph.
$d)$ Let $k(x)=f(2x)+f(x-2).$ Describe the domain of k and draw its graph.
The attempt at a solution: I drew graph of $f$, it would look like this (Except function is not defined when $x < 0$ or $x > 2$):

As for $b)$ and $c)$, since $g(x)=f(2x)$, on interval $0\le x\le1$, $g(x)=2$ as I understand, and on interval $1\lt x\le2$, $g(x)=4$, but since function $f$ is defined from $x=0$ to $x=2$, wouldn't same be true for $g(x)$? Wouldn't same be true for $c)$? What am I missing? because answer says that domain of function of $g(x)$ and $h(x)$ is different from domain of $f$, and domain of $k(x)=f(2x)+f(x-2)$ is empty.
 A: Notice that for $(b)$
$$0\leq 2x \leq 1 \Rightarrow 0 \leq x \leq \frac{1}{2}$$ and $$1 \leq 2x \leq 2 \Rightarrow \frac{1}{2}\leq x \leq 1$$
The domain of $g$ is $\Big[0,\frac{1}{2}\Big] \cup \Big[\frac{1}{2},1\Big] = [0,1]$.
Similar goes for $(c)$. As for $(d)$ we have
$$\Big[0,\frac{1}{2}\Big]\cap\Big[\frac{1}{2},1\Big]\cap[2,4]\cap[3,5] = \emptyset$$ 
A: For the function $g(x) = f(2x)$, let $t = 2x$.  Then $x = t/2$.  We know that 
$$f(t) = 
\begin{cases}
1 & \text{if $0 \leq t \leq 1$}\\
2 & \text{if $1 < t \leq 2$}
\end{cases}
$$
Replacing $t$ by $2x$ yields
$$f(2x) = 
\begin{cases}
1 & \text{if $0 \leq 2x \leq 1$}\\
2 & \text{if $1 < 2x \leq 2$}
\end{cases}
$$
Thus, 
$$g(x) = 
\begin{cases}
1 & \text{if $0 \leq x \leq \dfrac{1}{2}$}\\
2 & \text{if $\dfrac{1}{2} < x \leq 1$}
\end{cases}
$$
so the domain of $g$ is $[0, 1]$, which is obtained from the domain of $f$ by dividing each element in the domain of $f$ by $2$.  
For the function $h(x) = f(x - 2)$, let $t = x - 2$.  Then $x = t + 2$.  Thus, the domain of $h$ is $[2, 4]$, which is obtained by adding $2$ to each element in the domain of $f$.
The domain of $k(x)$ is the intersection of the domains of $g(x)$ and $h(x)$.
Note that the transformation $x \to 2x$ stretches the graph horizontally by a factor of $1/2$, while the transformation $x \to x - 2$ shifts the graph horizontally to the right by $2$ units.  
