Differentiating the function $x^3\cdot\min\{x,9\}$ Today I came across the function $x^3\cdot \min\{x,9\}$.
My teacher differentiated it and wrote it directly again as $3x^2\cdot\min\{x,9\}$
I was wondering how come the $\min\{x,9\}$ part is not affected by differentiation. Any ideas please? Or am I missing something pretty obvious?
 A: You have a piecewise defined function here: if $x<9$, then $\min(x,9)=x$ and $f(x)=x^3\cdot x=x^4$.  But if if $x>9$, then $\min(x,9)=9$ and $f(x)=x^3\cdot 9=9x^3$.
So, your function is $$f(x)=\cases{ x^4, &x<9\cr 9x^3,&x\ge9}$$
You'll have to find the derivative separately for each piece:
For $x<9$, $$\tag{1}f'(x)=(x^4)'=4x^3.$$
For $x>9$, $$\tag{2}f'(x)=(9x^3)'=27x^2.$$
At $x=9$, in order to determine if $f'(9)$ is defined, you need to see if the above formulas  "match up" at $x=9$.  That is, you need to check that the "derivative at 9" given by (1) and (2) are the same. So, you need to compute the limit of the expression in (1) as $x$ approaches 9 from the left, and the limit of the expression in (2) as $x$ approaches 9 from the right:
$$
\lim_{x\rightarrow 9^-} 4x^3=4\cdot 9^3.
$$
$$
\lim_{x\rightarrow 9^+}27x^2=27\cdot9^2=3\cdot 9^3.
$$
Since the two are different, $f'(9)$ is undefined.

See Jonas' astute observation below.  

Looking at the graph of $f$ and the expressions (1) and (2), it is not too hard to see that $f'(9)$ exists if and only if the two limits above exist and are equal. The previous statement, however, is not true in general.
A: Another way of looking at the mistake made by your teacher is that he forgot how to differentiate the product of two functions. The derivative of the first factor $f(x)=x^3$ is, indeed, $f'(x)=3x^2$, but the derivative of the second factor $g(x)=\min\{x,9\}$ is $g'(x)=1,$ if $x<9$, and $g'(x)=0$, if $x>9$. As others have pointed out, $g(x)$ is not differentiable at the point $x=9$. The correct derivative is thus
$$
\frac d{dx}\,\big(f(x)g(x)\big)=f'(x)g(x)+f(x)g'(x),
$$
wherever the two derivatives both exist.
It is, of course, an easy exercise to verify that this formula coincides with the answer David Mitra gave.
