# How Can We Approximate a Continuous Function with a Piece-Wise Linear Function?

• MHB
• joypav
In summary, the conversation discusses an exercise in real analysis involving the construction of a piece-wise linear function on a closed interval [a, b]. The function is required to be within a certain distance of a continuous function on the interval. The conversation also touches on the importance of uniform continuity in proving this result.
joypav
This is an exercise given in my real analysis course. We have definitions for continuity, uniform continuity, l.s.c and u.s.c., but I don't see how to apply them.
I guess I want to construct $φ$ piece by piece of the interval to eventually cover all of [a,b]?

Exercise:
A continuous function $φ$ on [a, b] is called piece-wise linear provided there is a partition
$a = x_0 < x_1 < · · · < x_n = b$ of [a, b] for which φ is linear on each interval $[x_{i−1}, x_i]$.
Let f be a continuous function on [a, b] and $\epsilon$ a positive number. Show that there is a
piece-wise linear function $φ$ on [a, b] with |$f(x) − φ(x)$| $< \epsilon$ for all x ∈ [a, b].

joypav said:
I guess I want to construct $φ$ piece by piece of the interval to eventually cover all of [a,b]?

Hi joypav,

That sounds like a plan, or perhaps we can start with a uniform partition $x_i=a+ih$.
And then apply the $\varepsilon$-$\delta$-definition of continuity to a point $x_i$.

Since f is continuous, at each point $$x_0$$, there exist some $$\delta> 0$$ such that is $$|x- x_0|< \delta$$ then $$|f(x)- f(x_0)|< \epsilon$$. Take $$x_i$$ and $$x_{i+1}$$ such that $$|x_{i+1}- x_i|< \delta$$ and take the linear approximation to be the straight line from $$(x_i, f(x_i))$$ to $$(x_{i+1}, f(x_{i+1})$$.

Country Boy said:
Since f is continuous, at each point $$x_0$$, there exist some $$\delta> 0$$ such that is $$|x- x_0|< \delta$$ then $$|f(x)- f(x_0)|< \epsilon$$. Take $$x_i$$ and $$x_{i+1}$$ such that $$|x_{i+1}- x_i|< \delta$$ and take the linear approximation to be the straight line from $$(x_i, f(x_i))$$ to $$(x_{i+1}, f(x_{i+1})$$.
Notice that this method uses the fact that $f$ is uniformly continuous (so that you can use the same $\delta$ for each $x_i$). I think it would be much harder to prove the result without using uniform continuity.

Opalg said:
Notice that this method uses the fact that $f$ is uniformly continuous (so that you can use the same $\delta$ for each $x_i$). I think it would be much harder to prove the result without using uniform continuity.

Isn't a continuous function on a closed interval [a, b] uniformly continuous?

I like Serena said:
Isn't a continuous function on a closed interval [a, b] uniformly continuous?
Yes – I just wanted to point out that it is necessary to use that fact here.

I wrote up a proof.. I'll post it sometime today if y'all don't mind taking a look!

Consider a partition, $x_i = a + ih$, $h = \frac{b-a}{n}$, $n \in \Bbb{N}$.
Then $x_0 = a + 0(h) = a$ and $x_n = a + n(\frac{b-a}{n}) = a + b - a = b$.
Also, notice $x_0 < x_1 < ... < x_n$.
Because, $\forall i, 0 \leq i \leq n, x_i = a + ih < a + ih + h = x_{i+1}$

Consider, $(x_i, f(x_i)), (x_{i+1}, f(x_{i+1}))$ and the straight line connecting them.

Slope $= \frac{f(x_{i+1})-f(x_i)}{x_{i+1}-x_i} = \frac{f(x_{i+1})-f(x_i)}{a + ih + h -a -ih} = \frac{f(x_{i+1})-f(x_i)}{h}$
Let,
$\phi(x) = \frac{f(x_{i+1})-f(x_i)}{h} \cdot (x-x_i) + f(x_i)$

Now consider the difference,
$\left| f(x) - \phi(x) \right| = \left| f(x) - (\frac{f(x_{i+1})-f(x_i)}{h} \cdot (x-x_i) + f(x_i)) \right|$
$= \left| f(x) + \frac{f(x_{i+1})-f(x_i)}{h} \cdot (x_i-x) - f(x_i) \right| = \left| f(x) - f(x_i) + \frac{f(x_{i+1})-f(x_i)}{h} \cdot (x_i-x) \right|$

By continuity of f on [a,b], f is continuous at $x_i$
$\implies \forall \epsilon_1>0, \exists \delta_1>0, \left| x-x_i \right|<\delta_1 \implies \left| f(x)-f(x_i) \right|<\epsilon_1$
Choose $\epsilon_1 < \epsilon / 2$.

f continuous on [a,b] a subset of R, [a,b] closed and bounded $\implies$ f is uniformly continuous on [a,b].
$\implies$ for $x_i, x_{i+1} \in [a,b]$,
$\implies \forall \epsilon_2>0, \exists \delta_2>0, \left| x_{i+1}-x_i \right|<\delta_2 \implies \left| f(x_{i+1})-f(x_i) \right|<\epsilon_2$
Choose $\epsilon_2 = \frac{\epsilon h}{2\delta_1}$.

Then,
$\left| f(x) - f(x_i) + \frac{f(x_{i+1})-f(x_i)}{h} \cdot (x_i-x) \right| < \epsilon_1 + \frac{\epsilon_2}{h}\cdot \delta_1 = \epsilon$
for $\delta = min(\delta_1, \delta_2)$.

## 1. What is a piece-wise linear function?

A piece-wise linear function is a mathematical function that consists of multiple linear segments, or pieces, connected together. Each piece is defined by a different linear equation, and the function as a whole is continuous.

## 2. How do you graph a piece-wise linear function?

To graph a piece-wise linear function, first graph each individual linear segment separately using its corresponding equation. Then, connect the segments to create a continuous graph.

## 3. What is the difference between a piece-wise linear function and a regular linear function?

A regular linear function has one linear equation that applies to the entire domain, while a piece-wise linear function has multiple linear equations that apply to different parts of the domain.

## 4. What is the significance of piece-wise linear functions in real-world applications?

Piece-wise linear functions are useful in modeling situations where a relationship between two variables changes at distinct points. They are commonly used in economics, engineering, and physics to represent non-linear phenomena.

## 5. Can a piece-wise linear function have more than two pieces?

Yes, a piece-wise linear function can have any number of linear segments, depending on the complexity of the relationship being modeled. However, as the number of pieces increases, the function becomes more difficult to graph and analyze.

• Topology and Analysis
Replies
2
Views
337
• Topology and Analysis
Replies
4
Views
1K
• Topology and Analysis
Replies
2
Views
1K
• Topology and Analysis
Replies
2
Views
1K
• Topology and Analysis
Replies
9
Views
2K
• Topology and Analysis
Replies
17
Views
3K
• Topology and Analysis
Replies
14
Views
2K
• Calculus and Beyond Homework Help
Replies
26
Views
1K
• Topology and Analysis
Replies
4
Views
2K
• Calculus and Beyond Homework Help
Replies
1
Views
470