Tutorials › Calculus III › Differentiability of Piecewise Functions at a Point

Differentiability and Linearization · Tutorial 332 of 999

Differentiability of Piecewise Functions at a Point

Use continuity and partial derivatives as preliminary checks, then test the remainder to decide whether a piecewise function is differentiable at its joining point.

Intermediate 10 min read

What You'll Learn

  • Check continuity at a joining point before testing differentiability.
  • Find candidate partial derivatives from the coordinate-axis difference quotients.
  • Use those partial derivatives to form the candidate linear approximation.
  • Test the remainder relative to the distance from the point.
  • Distinguish necessary conditions from a sufficient differentiability test.
  • Identify common ways a piecewise function can fail to be differentiable.

Why Piecewise Differentiability Needs Care

A piecewise formula can look smooth on each side of a boundary and still fail to be differentiable where the formulas meet. At a joining point, the function’s value, its behavior along the coordinate directions, and its behavior along every other direction all matter.

For a function of two variables, the partial derivatives describe changes along the coordinate axes. Differentiability asks for more: near the point, one linear function must approximate the change in the function with an error that becomes negligible compared with the distance moved. This distinction is especially important for piecewise functions, where different formulas may govern different approaches to the same point.

Definition and the Candidate Linear Part

Definition: A function \(f\) is differentiable at \((a,b)\) if there are numbers \(A\) and \(B\) such that $$ f(a+h,b+k)-f(a,b)=Ah+Bk+R(h,k), $$ where $$ \lim_{(h,k)\to(0,0)} \frac{R(h,k)}{\sqrt{h^2+k^2}}=0. $$ The expression \(Ah+Bk\) is the candidate linear part, and \(R(h,k)\) is the remainder.

The quotient condition says that the error is small compared with the distance \(\sqrt{h^2+k^2}\) from the point. The remainder-ratio test is the direct way to check whether a proposed linear part works.

If \(f\) is differentiable, its partial derivatives must exist, and the coefficients in the linear part must be those partial derivatives:

$$ A=f_x(a,b), \qquad B=f_y(a,b). $$

These are necessary conditions, not a guarantee of differentiability. A piecewise function may have both partial derivatives at the joining point, yet fail to have a single linear approximation that works for approaches in all directions.

Why the Partial Derivatives Determine the Coefficients

Suppose the differentiability definition holds. First approach the point along the \(x\)-axis by setting \(k=0\). For \(h\ne 0\), divide the expansion by \(h\):

$$ \frac{f(a+h,b)-f(a,b)}{h} = A+\frac{R(h,0)}{h}. $$

Since \(\sqrt{h^2+0^2}=|h|\), the remainder condition implies \(R(h,0)/h\to 0\). Therefore the partial derivative \(f_x(a,b)\) exists and equals \(A\). Setting \(h=0\) instead gives

$$ \frac{f(a,b+k)-f(a,b)}{k} = B+\frac{R(0,k)}{k} \longrightarrow B, $$

so \(f_y(a,b)=B\). Thus, whenever differentiability holds, the only possible candidate linear part is \(f_x(a,b)h+f_y(a,b)k\). To establish differentiability, one must still show that the remainder built from this candidate satisfies the required limit.

A Practical Test at a Joining Point

For a piecewise function, begin by checking the value and nearby behavior at the joining point. If the function is not continuous there, it cannot be differentiable there. If continuity holds, calculate both partial derivatives from their definitions, rather than assuming that differentiating the formula on one side is enough. Finally, subtract the candidate linear part and test the remainder divided by the distance to the point.

1
Check continuity.
Compare the function’s value at the point with the limit of the piecewise formulas as the point is approached.
2
Find the partial derivatives.
Use the coordinate-axis difference quotients to find the candidate coefficients.
3
Form the remainder.
Subtract the value at the point and the candidate linear part from the nearby function value.
4
Test all approaches.
Determine whether the remainder divided by the distance tends to zero, not merely along the axes.

Worked Examples

Worked Example: A Jump at the Joining Point

Define \(f(x,y)=1\) when \(x>0\), and \(f(x,y)=0\) when \(x\leq 0\). Determine whether \(f\) is differentiable at \((0,0)\).

At the joining point, the second branch gives \(f(0,0)=0\). Along points \((t,0)\) with \(t>0\), however, \(f(t,0)=1\), while along points \((-t,0)\) with \(t>0\), \(f(-t,0)=0\). These values do not approach the same limit as the points approach \((0,0)\).

Thus \(f\) is discontinuous at \((0,0)\). Differentiability implies continuity, so \(f\) cannot be differentiable there. There is no reason to proceed to a remainder test once this necessary condition has failed.

Check: The values along the two approaches are exactly \(1\) and \(0\); therefore no single limit at the origin exists.

Worked Example: Partial Derivatives Exist but Differentiability Fails

Define \(f(x,y)=\frac{x^2y}{x^2+y^2}\) for \((x,y)\ne(0,0)\), and \(f(0,0)=0\). Test differentiability at the origin.

First check continuity. Write \(r=\sqrt{x^2+y^2}\). Since \(x^2\leq r^2\) and \(|y|\leq r\),

$$ |f(x,y)| = \frac{x^2|y|}{r^2} \leq \frac{r^2r}{r^2} =r. $$

As \((x,y)\to(0,0)\), \(r\to0\), so the bound shows \(f(x,y)\to0=f(0,0)\). The function is continuous at the origin.

Along either coordinate axis, the numerator is zero. Hence, for \(h\ne0\) and \(k\ne0\), respectively,

$$ \frac{f(h,0)-f(0,0)}{h}=0, \qquad \frac{f(0,k)-f(0,0)}{k}=0. $$

Both partial derivatives exist and equal zero. The only possible candidate linear part is therefore \(0h+0k=0\). The remainder is \(R(x,y)=f(x,y)\).

Now approach along \(y=x\), taking \(x=t\ne0\). Then \(f(t,t)=t/2\), while the distance to the origin is \(\sqrt{2}|t|\). Consequently,

$$ \left| \frac{R(t,t)}{\sqrt{t^2+t^2}} \right| = \frac{|t|/2}{\sqrt{2}|t|} = \frac{1}{2\sqrt{2}}. $$

This value does not tend to zero. The remainder condition fails, so \(f\) is not differentiable at \((0,0)\).

Check: The function is continuous and both partial derivatives are zero, but the remainder ratio along \(y=x\) stays equal in absolute value to \(1/(2\sqrt{2})\), not zero.

Worked Example: Different Formulas with a Shared Linear Part

Define \(f(x,y)=2x-y+x^2\) when \(y\geq0\), and \(f(x,y)=2x-y+3y^2\) when \(y<0\). Determine whether \(f\) is differentiable at \((0,0)\).

Both branches give \(f(0,0)=0\). For \(y\geq0\), the difference from \(2x-y\) is \(x^2\); for \(y<0\), it is \(3y^2\). In either case, the absolute difference is at most \(3(x^2+y^2)\). This tends to zero at the origin, so \(f\) is continuous there.

For the \(x\)-partial derivative, the line \(y=0\) uses the first branch. For \(h\ne0\),

$$ \frac{f(h,0)-f(0,0)}{h} = \frac{2h+h^2}{h} = 2+h \longrightarrow 2. $$

For the \(y\)-partial derivative, evaluate on the \(y\)-axis. If \(k>0\), then \(f(0,k)=-k\); if \(k<0\), then \(f(0,k)=-k+3k^2\). Thus

$$ \frac{f(0,k)-f(0,0)}{k} = \begin{cases} -1, & k>0,\\ -1+3k, & k<0, \end{cases} \longrightarrow -1. $$

The candidate linear part is \(2x-y\). The remainder is \(x^2\) for \(y\geq0\) and \(3y^2\) for \(y<0\). In both regions, with \(r=\sqrt{x^2+y^2}\),

$$ |R(x,y)|\leq 3(x^2+y^2)=3r^2, \qquad \frac{|R(x,y)|}{r}\leq 3r\longrightarrow0. $$

This bound applies regardless of which region contains \((x,y)\). Therefore the remainder condition holds, and \(f\) is differentiable at the origin, with candidate linear part \(2x-y\).

Check: The partial derivatives give coefficients \(2\) and \(-1\), matching the linear part used. The remainder ratio is bounded by \(3r\), which tends to zero.

Common Mistake: Stopping After Checking the Axes

A frequent error is to calculate the partial derivatives and then conclude that the function is differentiable. The second example shows why that conclusion is not valid: both partial derivatives exist, but a diagonal approach makes the remainder ratio fail to approach zero. The axes test only coordinatewise changes; differentiability requires the same linear approximation to work for every way of approaching the point.

Another error is to check only that the formulas on either side have derivatives. Differentiability at a joining point is a property of the function there, including how the pieces fit together. The value at the point must agree with the limiting behavior, and the full remainder test must succeed.

What the Test Establishes

The continuity check and the partial-derivative calculations help identify whether differentiability is possible and what its linear part must be. Neither replaces the remainder test. A successful remainder estimate, such as a bound by a constant times \(r^2\), is often an efficient way to prove that the ratio tends to zero: dividing that bound by \(r\) leaves a quantity proportional to \(r\), which vanishes at the point.

When a test along one path gives a remainder ratio that does not tend to zero, that path alone is enough to disprove differentiability. When a path gives a ratio tending to zero, that is not enough to prove differentiability; the limit must hold over all approaches. For piecewise functions, estimates that cover every branch near the joining point are particularly useful.

Check Your Understanding

Use the continuity check, candidate partial derivatives, and remainder condition to reason through these questions.

  1. Why does discontinuity at a joining point immediately rule out differentiability there?
  2. If both partial derivatives exist at a point, what do they determine about a possible linear part?
  3. For \(f(x,y)=x^2y/(x^2+y^2)\), what path shows that the remainder ratio does not tend to zero?
  4. In the third example, why is the bound on the remainder sufficient even though the formula changes across \(y=0\)?
  5. Why can checking a remainder ratio along the coordinate axes not prove differentiability?