Analysis-Baby Rudin's differentiability and continuity: theorem 5.2 and 5.6

I am very confused about differentiability and continuity. At the beginning of the differentiation chapter, we proved that differentiability contains continuity. (Theorem 5.2) But in example 5.6 and the next section of the chapter implies that there is a function that is differentiable at some points or interval but the function is not continuous. I guess I am missing something or misunderstanding definition of continuity and differentiability. Please help how I can understand the basic definition and ideas of continuity and differentiability. Thanks in advance

• Do you understand the difference between a function being continuous (respectively differentiable) and it being continuous at a point (respectively differentiable at a point)? – Git Gud Nov 14 '14 at 13:38
• Do you mean difference between continuous at a point and at an interval? If it is continuous at every point in the interval or set, then it is continuous on the interval or set. If you are not talking about this, then I don't know. – Kane Nov 14 '14 at 14:05
• That's what I'm talking about. "There is a function that is differentiable at some points or interval but the function is not continuous". A function can very well be differentiable at $a$ and not continuous at $b$ exactly because of the difference between the concepts in the first comment. If this isn't clear to you, perhaps it would help if you posted the example(s) that bothers you. – Git Gud Nov 14 '14 at 14:07
• I am not looking at an example but I was reading the book and to me it was contradiction. So if a function is differentiable at point c, then it is continuous at c. If it is differentiable at (a,b), then it is continuous at (a,b). But is lets say if the function is defined larger interval then (a,b) and it is not continuous out of (a,b) but within the whole interval that the function is defined. Is this the case that is differentiable but not continuous? Thanks – Kane Nov 14 '14 at 14:14
• f may have a derivative f' which exists at every point, but is discontinuous at some point. This statement confuses me. Does this mean f' may discontinuous? Then it does make sense. If f' exists at every point then f is continuous at every point but I have not proved that f' is also continuous at every point. – Kane Nov 14 '14 at 14:24

We say that a function $f\colon (a,b)\to \mathbb{R}$ is continuous at a point $c\in (a,b)$ if $\lim_{x\to c}f(x)$ exists and is equal to $f(c)$ (there exists of course other equivalent definitions for continuity). The main point is that continuity is defined only at a point. The phrase "$f$ is continuous in a interval $(a,b)$" just means that $f$ is continuous at every point $c\in (a,b)$.
Differentiability is again defined pointwise, and we say that a function $f$ is differentiable at $c\in (a,b)$ if $$\lim_{h\to 0}\frac{f(c+h)-f(c)}{h}$$ exists and in that case the limit is the derivative of $f$ at a point $c$. Again when we say that a function is differentiable in an interval $(a,b)$ we mean that the above limit exists for every $c\in (a,b)$. It is a well known fact that differentiability at a point $c$ implies continuity in $c$, but differentiability at $c$ does not imply differentiability nor continuity at any other point apart from $c$. Nor can you conclude that $f'$ would be continuous.
A common example of a differentiable function, for which the derivative is not continuous at origin is $$f(x)=\cases{ x^2\sin(1/x),\ &x\neq 0\\ 0,\ &x=0}.$$