Given f(x) = cases 1+x, x < 0,, x, 0 < x < 1,, 2-x, 1 < x
Given $f(x) = \begin{cases} 1+x, & x \lt 0, \\ x, & 0 \lt x \lt 1, \\ 2-x, & 1 \lt x \lt 2, \\ 3x-x^{2}, & x \gt 2, \end{cases}$ 1° sketch the graph; 2° for which $x$ is $f$ continuous? 3° for which $x$ does $f'(x)$ exist? 4° for which $x$ is $f'$ continuous?
Explanation of Method
Reading continuity, differentiability and smoothness off a four-piece graph.
Step 1: The graph
Note first that the definition uses strict inequalities, so $f$ is not assigned any value at $x = 0$, $1$ or $2$. Open circles mark the missing endpoints.
Reading left to right: a line of slope $1$ rising to height $1$; a jump down to $0$; a line of slope $1$ up to height $1$; a line of slope $-1$ down to $0$; a jump up to $2$; then the falling arc of the parabola $3x-x^{2}$.
Step 2: Continuity (2°)
Inside each open piece $f$ is a polynomial, hence continuous. Only the three junctions need checking.
\[x = 0:\quad \lim_{x\to 0^{-}}(1+x) = 1, \qquad \lim_{x\to 0^{+}}x = 0 \;\Longrightarrow\; \text{jump}\]
\[x = 1:\quad \lim_{x\to 1^{-}}x = 1, \qquad \lim_{x\to 1^{+}}(2-x) = 1 \;\Longrightarrow\; \text{limits agree}\]
\[x = 2:\quad \lim_{x\to 2^{-}}(2-x) = 0, \qquad \lim_{x\to 2^{+}}\bigl(3x-x^{2}\bigr) = 2 \;\Longrightarrow\; \text{jump}\]
So $f$ is continuous at every point of its domain $\mathbb{R}\setminus\{0,1,2\}$. At $x = 1$ the discontinuity is removable: setting $f(1) = 1$ makes $f$ continuous there. At $x = 0$ and $x = 2$ the jumps are genuine and no assignment of a value can repair them.
Step 3: Existence of $f'$ (3°)
On each open piece $f$ is differentiable, with
\[ f'(x) = \begin{cases} 1, & x \lt 0, \\ 1, & 0 \lt x \lt 1, \\ -1, & 1 \lt x \lt 2, \\ 3-2x, & x \gt 2. \end{cases} \]
At $x = 0$ and $x = 2$ the function is discontinuous, and a function that is not continuous at a point cannot be differentiable there. At $x = 1$, taking the repaired value $f(1) = 1$, the one-sided derivatives are
\[f'_{-}(1) = \lim_{h\to 0^{-}}\frac{(1+h)-1}{h} = 1, \qquad f'_{+}(1) = \lim_{h\to 0^{+}}\frac{\bigl(2-(1+h)\bigr)-1}{h} = \lim_{h\to 0^{+}}\frac{-h}{h} = -1.\]
They are finite but unequal, so $f'(1)$ does not exist: the graph has a corner at the peak. Hence $f'$ exists exactly on $\mathbb{R}\setminus\{0,1,2\}$.
Step 4: Continuity of $f'$ (4°)
On its domain $f'$ is piecewise constant or linear, hence continuous. It is worth looking at what happens at the three excluded points, because the three cases differ: \[x = 0:\quad \lim_{x\to 0^{-}}f' = 1 = \lim_{x\to 0^{+}}f' \;\Longrightarrow\; \text{the limits agree}\]
\[x = 1:\quad \lim_{x\to 1^{-}}f' = 1, \qquad \lim_{x\to 1^{+}}f' = -1 \;\Longrightarrow\; \text{genuine jump in } f'\]
\[x = 2:\quad \lim_{x\to 2^{-}}f' = -1, \qquad \lim_{x\to 2^{+}}\bigl(3-2x\bigr) = -1 \;\Longrightarrow\; \text{the limits agree}\]
So $f'$ is continuous on $\mathbb{R}\setminus\{0,1,2\}$. At $x = 0$ and $x = 2$ the derivative is undefined only because $f$ itself is; its one-sided limits match, so the discontinuity of $f'$ there is removable. Only at $x = 1$ does $f'$ genuinely jump.
Result
Final answer:
\[\boxed{\,\begin{aligned} &\text{continuous: } x\in\mathbb{R}\setminus\{0,1,2\}\ \ (\text{and at } x=1 \text{ if } f(1):=1), \\ &f'(x)\ \text{exists: } x\in\mathbb{R}\setminus\{0,1,2\}, \\ &f'(x)\ \text{continuous: } x\in\mathbb{R}\setminus\{0,1,2\}. \end{aligned}\,}\]
Remark
Remark. The three junctions illustrate three different failures. At $x=0$ and $x=2$ the function jumps, so differentiability is lost for the crudest reason. At $x=1$ the function is (after repair) perfectly continuous, yet still not differentiable — the slopes on the two sides disagree. Note also that matching one-sided limits of $f'$ at $x = 0$ and $x = 2$ do not rescue differentiability there: the theorem that $\lim f' = L$ forces $f' = L$ requires continuity of $f$ at the point, which is exactly what fails (compare Problem 23).