# How to know when one has license to define a new function to assist in completing a solution. - Example from Spivak Calculus - Ch 14

Using question question: 14-9 from Spivak's Calculus. The chapter revolves around the ideas of the Fundamental Thoerem of Calculus. I have a question about how do you know if/when you have license to "define" another function to assist in trying to create a solution ? The following screenshot is of the question I was attempting to solve: $$f(x) = \begin{cases} \cos\frac{1}{x},\ &x\ne 0\\0,&x=0 \end{cases}$$ Is $$F(x)=\int_0^x f\,$$ differentiable at $$x=0$$?

The solution is as follows:

If $$g(x) = \begin{cases} x^2\sin\frac{1}{x},\ &x\ne 0\\0,&x=0 \end{cases}$$ then $$g'(x) = \begin{cases} 2x\sin\frac{1}{x}-\cos\frac{1}{x},\ &x\ne 0\\0,&x=0 \end{cases}$$ So if we define $$h(x) = \begin{cases} 2x\sin\frac{1}{x},\ &x\ne 0\\0,&x=0 \end{cases}$$ We have $$f(x)=h(x)-g'(x)\quad\textrm{for all }x.$$ Hence \begin{align}F(x) = & \, \int_0^x (h-g') \\ = & \, \left(\int_0^x h\right) -g, \end{align} using the second Fundamental Theory of Calculus (and not merely the Corollary of the First Fundamental Theorem). Since $$h$$ is continuous we may then apply the First Fundamental Theorem to conclude that, \begin{align}F(0) = & \, h(0)-g'(0) \\ = & \, 0. \end{align}

So let me take you through my thought process first before I get into specifics. After looking at the hint, seeing that the original question was asking about $$f(x) = \cos(\frac{1}{x})$$, I deduced that since $$\cos(\frac{1}{x})$$ is not continuous at $$0$$, then the function $$f(x)$$ is not continuous at $$0$$, which would imply that FTC could not be applied and $$F(x)$$ is not differentiable.

Here is where my question comes up. As you can see in the solution, Spivak defined a new function $$h(x)$$ and used this to illustrate that $$F(x)$$ is indeed differentiable at $$0$$.

I understand the solution to this question in particular and the logic, but it is how/why/when can one "define" a new function and use it in this way and similar ways ? I ask because this sort of thing keeps on popping up when I'm working through exercises regardless of the math subject and it throws me off. I'm not sure there is a succinct answer to this, but perhaps some sort of guidance on how to look out for these things in the future ?

• I don't really understand your question. You can define anything you like, whenever you like. Whether it is of great mathematical use is situation dependent. A good quote I like is "this is math, everything is made up". – epiliam Aug 25 '20 at 0:01
• Fitting quote. I think it captures what I'm struggling with. In this question then what would be the impetus to define a function though?..I see its use, but it would never dawn on me at least up to this point in time to define a new function $h(x)$ and proceed.... – dc3rd Aug 25 '20 at 0:13
• Its just to help with notation. All they have said is $f=f+g'-g'$ and $f+g'$ is continuous therefore.... etc. Its just nicer to write $h=f+g'$. – epiliam Aug 25 '20 at 0:17
• What's on p. 177? – zhw. Aug 25 '20 at 0:37
• @zhw., the function defined as $g'(x)$ in the above posted solution. – dc3rd Aug 25 '20 at 0:46

Regarding the issue raised in the comments, yes, $$f$$ is integrable (in the Riemann/Darboux sense) on every compact interval in $$\Bbb{R}$$ (i.e for every $$a, $$f$$ is integrable on $$[a,b]$$). This is because $$f$$ is continuous everywhere except for $$0$$ (as the OP should take for granted until the next chapter which proves basic properties of trig functions), and $$f$$ is bounded (in fact, if $$f:[a,b]\to \Bbb{R}$$ is bounded and continuous except for a finite set of points, then it is still integrable). Therefore, the function $$F(x) = \int_0^x f$$ is well-defined.

Now, you say

I deduced that since $$\cos(\frac{1}{x})$$ is not continuous at $$0$$, then the function $$f(x)$$ is not continuous at $$0$$

well, a small technical detail: $$\cos(1/x)$$ is not even defined at $$0$$ so it doesn't make sense to speak of it being continuous at $$0$$. What you probably should have said is that "since $$\lim\limits_{x\to 0}\cos\left(\frac{1}{x}\right)$$ does not exist..." Next, you continue

which would imply that FTC could not be applied and $$F(x)$$ is not differentiable.

Again, there's a mistake in your logic. You're right that since $$f$$ is not continuous at $$0$$, you cannot apply the FTC as stated in Spivak's text, simply because the hypotheses of the theorem have not been satisfies. BUT, this is no way implies that $$F$$ is not differentiable at $$0$$. All this says is that you have to be more cautious before making any conclusions.

but it is how/why/when can one "define" a new function and use it in this way and similar ways ?

To answer "how can one know to define such a function", the answer is just "practice and keep reading". Sometimes, you'll learn cool new tricks just by doing more math. As for "why" define a new function, it's because "it works". As for "when can one define...", the answer is you can define anything you want whenever you want (as long as you're doing things logically and not introducing any contradictions). The difficult part is in knowing whether such a definition is useful; this is something you only learn with practice.

At first glance, this solution of Spivak's does seem pretty random, but if you analyze it carefully, all he's done is take the guess-work out of integration by parts. For $$x\neq 0$$, we have (by multiplying and dividing by the derivative of $$1/x$$) \begin{align} \cos\left(\frac{1}{x}\right) &= \left(\dfrac{-1}{x^2}\right)\cos\left(\frac{1}{x}\right) \cdot (-x^2) \\ &= \dfrac{d}{dx}\left(\sin\left(\frac{1}{x}\right)\right) \cdot (-x^2) \\ &= \dfrac{d}{dx}\left(\sin\left(\frac{1}{x}\right) \cdot (-x^2)\right) - \sin\left(\frac{1}{x}\right)\cdot \dfrac{d}{dx}(-x^2) \tag{*} \\ &= 2x \cdot \sin\left(\frac{1}{x}\right) - \dfrac{d}{dx}\left(x^2 \sin\left(\frac{1}{x}\right)\right) \end{align} Step $$(*)$$ is exactly what integration by parts is based on (and trust me, this is one of the integration "tricks" which is pretty common... there are some integration tricks which are so much more "out of thin air"); namely the product rule in reverse.

So, really, all Spivak has done is a "clever" undoing of the chain and product rule; i.e "integration by parts" without really saying so (because he hasn't introduced this concept yet), and then he has concisely written up all these functions carefully, by defining them at $$x=0$$, and then he has invoked the theorems proven up to this point.

• Thanks once again for coming to the rescue @peek-a-boo. I'm getting the feeling Spivak doesn't expect you to complete all the exercises from a section because unless you're an undergraduate at the level of Terrance Tao I can't fathom how one could create such a solution encountering the material at this level of rigor for the first time.....just have to keep grinding away... – dc3rd Aug 25 '20 at 2:53
• @dc3rd don't worry, this is a starred problem, so it's not a huge deal if you don't get it immediately. I think it's pretty much impossible to work through every problem on your first try. What's more important is that you spend some time thinking about the problems, and if you still don't get it after having given an honest attempt, then just move on and (maybe) come back to it (but do as many as possible). I for one definitely remember skipping this problem and told myself I'd come back (turns out I did come back to it, but only because of your question :)) – peek-a-boo Aug 25 '20 at 2:56

I'm not sure I like Spivak's solution as it's a bit of rabbit from a hat. It seems to me there is intuition here that's being overlooked: We have

$$F(x) = \int_0^x\cos(1/t)\,dt.$$

Does $$F'(0)$$ exist? If it does it would appear that $$F'(0)=0,$$ simply because the crazy oscillation of $$\cos(1/t)$$ looks pretty evenly balanced between plus and minus. So maybe

$$\frac{F(x)-F(0)}{x-0}= \frac{F(x)}{x}\to 0.$$

What I would do is make the change of variables $$t=1/y.$$ Why do this? For one thing it turns $$\cos(1/t)$$ into $$\cos (y).$$ Doing that, we get

$$\frac{F(x)}{x} = \frac{1}{x}\int_{1/x}^\infty \frac{\cos(y)}{y^2}\,dy.$$

Integrate by parts ($$u=y^{-2}, dv = \cos(y)\,dy$$) and everything works out. In fact we find $$F(x)/x=O(x).$$

• (+1) I thought Spivak's solution was unsatisfactory also. And in fact, the approach you took is the one I would have followed (I'd rather look at $\cos(x)$ on $(1, \infty)$ than $\cos(1/x)$ on $(0,1)$). – Mark Viola Aug 25 '20 at 1:56
• One thing I've observed in Spivak's book is that it has not introduced any of the usual integration techniques one would learn in a beginner's or intermediary calculus course, he saves it for a future chapter. So up this point I'm restricted to solely the FTC. – dc3rd Aug 25 '20 at 1:59
• I agree. Although I understand using only the most fundamental of tools, the infinite oscillations at $0$ is something that requires more careful treatment. – epiliam Aug 25 '20 at 2:14