Home » Blog » Find the derivative of the given piecewise function

Find the derivative of the given piecewise function

Let

    \[ f(x) = \begin{cases} x^2 & \text{if } x \text{ is rational},\\ 0 & \text{if } x \text{ is irrational}. \end{cases} \]

Then define

    \[ Q(h) = \frac{f(h)}{h} \qquad \text{if } h \neq 0. \]

  1. Prove

        \[ \lim_{h \to 0} Q(h) = 0. \]

  2. Prove that f is differentiable at 0 and compute f'(0).

  1. Proof. Let \varepsilon > 0 be given. Then choose 0 < \delta = \varepsilon. Then if

        \[ | h - 0| < \delta \quad \implies \quad |h| < \delta \]

    we have

        \begin{align*}  \left| \frac{Q(h)}{h} - 0 \right| &= \begin{dcases} \frac{h^2}{|h|} = |h| & \text{if } h \in \mathbb{Q}, \\  0 & \text{if } h \in \mathbb{R} \smallsetminus \mathbb{Q}. \end{cases} \\  & < |h| = \varepsilon. \end{align*}

    Hence, we have found a \delta > 0 such that |Q(h)/h| < \varepsilon whenever |h - 0| < \delta. Therefore,

        \[ \lim_{h \to 0} \frac{Q(h)}{h} = 0. \qquad \blacksquare \]

  2. Proof. To show f has a derivative at 0 we must show that the limit

        \[ \lim_{h \to 0} \frac{f(0+h) - f(0)}{h} \]

    exists. We note that f(0) = 0 (since 0 is rational and 0^2 = 0), and compute

        \begin{align*}  f'(0) = \lim_{h \to 0} \frac{f(0+h) - f(0)}{h} &= \lim_{h \to 0} \frac{f(h) - f(0)}{h} \\  &= \lim_{h \to 0} \frac{f(h)}{h} \\  &= 0 & (\text{by part (a)}). \qquad \blacksquare \end{align*}

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):