Spivak's Calculus: Chapter 12, Problem 26 
Suppose that $f(x) > 0$ for all $x$, and that $f$ is decreasing. Prove that there is a continuous decreasing function $g$ such that $0 < g(x) \le f(x)$ for all $x$.

To be quite honest, I have no idea how to approach this problem. (I also have no clue about the second part, but I imagine a hint at this solution will help me along for part b.)
I thought about setting $g(x) = f(x + k)$ for some $k > 0$, but I don't know how to get continuity. I should also note that this is in the "Inverse Functions" chapter, so that must play some sort of role here, but I'm not sure how really.
Any hint at how to think about the problem, specifically about the "continuous" part of it would be much appreciated. Thanks.
 A: Define $g$ to be piecewise linear with $g(n)=f(n+1)$.  To elaborate, $g$ will be decreasing and continuous with
$$
g(x)\leq g(\lfloor x\rfloor)=f(\lfloor x\rfloor+1)\leq f(x).
$$
Or better yet, draw a picture.
A: I thought I would add this, since there seems to be some confusion about the implementation of yoyo's idea.
A useful concept is to note that the equation of a line can be formulated as: $L(x)=\frac{L(b)-L(a)}{b-a}\cdot(x-a)+L(a) \quad(*)$
Consider the below picture:

If we want to make an equation for the $g$ depicted in the above picture, then we could make use of $(*)$ and write:
$g(x)=\frac{g(n+1)-g(n)}{(n+1)-n}\cdot(x-n)+g(n)$
Looking more carefully at what $g(n)$ and $g(n+1)$ equal in the picture, we can further specify:
$g(x)=\frac{f(n+2)-f(n+1)}{(n+1)-n}\cdot(x-n)+f(n+1)$, which can obviously be written as: $g(x)=\big[f(n+2)-f(n+1)\big]\cdot(x-n)+f(n+1)$
If we want to extend the domain of $g$ to operate outside of the arbitrary interval $[n,n+1]$, we can take note of the following observations:
For $x \in [n,n+1]: n=\lfloor{x}\rfloor$
Now we can finally write:
$$g(x)=\big[f(\lfloor x \rfloor+2)-f(\lfloor x \rfloor+1)\big]\cdot(x-\lfloor x \rfloor)+f(\lfloor x \rfloor+1)$$
Because this argument was for arbitrary $n \in \mathbb Z$, and because all $x \in \mathbb R$ are in some closed interval of the form $[n,n+1]$, we have defined a function $g$ on all of $\mathbb R$.
Note that there is no ambiguity when $x=n+1$ (or when $x=n$). Even though $x$ would simultaneously satisfy $x \in [n,n+1]$ and $x \in [n+1,n+2]$, it is clear that our final $g$ equation would still output the same answer.
To see that $g(x) \gt 0$, note that $0 \leq x - \lfloor x \rfloor \lt 1$. Letting $c=x - \lfloor x \rfloor$, we can rewrite $g$ as:
$$g(x)=f(\lfloor x \rfloor +2) \cdot c + f(\lfloor x \rfloor+1)\cdot[1-c]$$
Because $c \lt 1$, we must have that $1-c \gt 0$. Given that $f$ is defined as $\gt 0$ for any $x$, we have that $f(\lfloor x \rfloor +2) \cdot c \geq 0$ and $f(\lfloor x \rfloor+1)\cdot[1-c] \gt 0$, which means that $g(x) \gt 0$.
