Regarding The Absolute Value Function

Agent Smith

Full Member
Joined
Oct 18, 2023
Messages
352
[imath]f(x) = |x|[/imath]
[imath]g(x) = f'(x)[/imath]20241121_075800.jpg

I didn't know that [imath]f(x)[/imath] was differentiable except when [imath]x = 0[/imath].

What if the point [imath](0, 0)[/imath] were important to me? It IS a minimum, could become a maximum under transformation.

Say a transformation of the absolute value function gives us the error E in some computation and I want to find the condition for min/max error. I won't be able to find the derivative, equate it to 0, and so on.

Say error [imath]E = |x - 4| + 2[/imath]. Do I do this:

E will be minimum when [imath]x - 4 = 0 \implies x = 4[/imath].

Do I do this [imath]E = \sqrt {(x - 4)^2} + 2[/imath]

Then [imath]\frac{dE}{dx} = \frac{1}{2} (x -4)^{-1} 2(x - 4) = 1[/imath]. Then that would mean there's no minimum since [imath]1 \ne 0[/imath]
20241121_081947.jpg
20241121_082134.jpg
 
Someone who is familiar with the graph of the absolute value will tell you directly [imath]f(4) = 2[/imath] is a minimum for the function [imath]f(x) = |x - 4| + 2[/imath].

But let us assume that you want to do the same task without any knowledge of the graph.

You think that it was a smart way to convert the function to [imath]f(x) = \sqrt{(x - 4)^2} + 2[/imath] (it might be). But it is very wrong to analyze this new form of the function normally assuming it is a smooth function. Smooth here means it is differentiable everywhere.

The correct approach is to analyze both versions, the original and the new form by writing them in a piecewise function form.

Since they are equivalent, they are equal to:

[imath]\displaystyle f(x) =\begin{cases}x - 2 & x \geq 4\\6 - x & x < 4\end{cases} [/imath]

Taking the derivative.

[imath]\displaystyle f'(x) =\begin{cases}1 & x \geq 4\\-1 & x < 4\end{cases} [/imath]

The derivative confirms that the function is not differentiable at [imath]x = 4[/imath]. We have assumed that we have no idea about the graph, but it is so obvious that the function is continues everywhere by observing its domain. All remains is to tell if [imath]f(4)[/imath] is a maximum, minimum, or neither.

By looking at the derivative again we observe that it is negative to the left of [imath]x = 4[/imath] and positive to the right. This behavior can tell only one thing for a continuous function that is [imath]f(4)[/imath] must be a minimum.
 
@mario99 thanks! No I didn't think it was smart of me to rephrase [imath]f(x) = |x - 4| + 2[/imath] as [imath]f(x) = \sqrt{(x - 4)^2} + 2[/imath]. It's just that I saw the substitution being made on some forum and I checked with desmos: the graphs are identical.

As you explained, it's better to treat the function as a piecewise function (that was amazing! It would've taken me a long time to figure that out).

Capture.PNG
Gracias
 
@mario99 thanks! No I didn't think it was smart of me to rephrase [imath]f(x) = |x - 4| + 2[/imath] as [imath]f(x) = \sqrt{(x - 4)^2} + 2[/imath]. It's just that I saw the substitution being made on some forum and I checked with desmos: the graphs are identical.

As you explained, it's better to treat the function as a piecewise function (that was amazing! It would've taken me a long time to figure that out).

View attachment 38836
Gracias
Usually, in the exam, you are given [imath]f(x) = \sqrt{(x - 4)^2} + 2[/imath]

And you have to figure out it is equivalent to:

[imath]f(x) = |x - 4| + 2[/imath]

And then you need to convert this to a piecewise function if you want to fully understand the behavior of the function.
--------
Many students will not notice that there is an absolute value involved, and they would normally do what you did. They will still get the correct answer this time, but it is just not the correct way to handle the absolute value. In many situations the direct approach will give incorrect results, so it is better to always convert absolute values to piecewise functions.
 
Question @mario99

How did you go from [imath]|x - 4| + 2[/imath] to [imath]x - 2[/imath] and [imath]6 - x[/imath]?
It is better to start with the very basic absolute value to understand the idea.

[imath]f(x) = |x|[/imath]

[imath]\displaystyle f(x) =\begin{cases}x & ,x \geq 0\\-x & ,x < 0\end{cases} [/imath]

Now you follow the same concept for:

[imath]g(x) = |x - 4|[/imath]

[imath]\displaystyle g(x) =\begin{cases}x - 4 & ,x - 4 \geq 0\\4 - x & ,x - 4 < 0\end{cases} [/imath]

Or

[imath]\displaystyle g(x) =\begin{cases}x - 4 & ,x \geq 4\\4 - x & ,x < 4\end{cases} [/imath]

[imath]h(x) = |x - 4| + 2[/imath] is just [imath]g(x) + 2[/imath], so:

[imath]\displaystyle h(x) =\begin{cases}x - 4 + 2 & ,x \geq 4\\4 - x + 2 & ,x < 4\end{cases} [/imath]

Or

[imath]\displaystyle h(x) =\begin{cases}x - 2 & ,x \geq 4\\6 - x & ,x < 4\end{cases} [/imath]
 
Top