document.write( "Question 1087149: Consider the function f(x)= |x-1|+|x-2|\r
\n" ); document.write( "\n" ); document.write( "Show that f(x)= -2x+3, if x ≤ 1
\n" ); document.write( "1 if 1 < x < 2
\n" ); document.write( "2x-3 if x ≥ 2
\n" ); document.write( "

Algebra.Com's Answer #701422 by jim_thompson5910(35256)\"\" \"About 
You can put this solution on YOUR website!
Given function: \"f%28x%29+=+abs%28x-1%29%2Babs%28x-2%29\"
\n" ); document.write( "Let \"g%28x%29+=+abs%28x-1%29\" and \"h%28x%29+=+abs%28x-2%29\"
\n" ); document.write( "That means \"f%28x%29+=+g%28x%29%2Bh%28x%29\"\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "We can write the absolute value functions, g(x) and h(x), into piecewise function form
\n" ); document.write( "For g(x) we have
\n" ); document.write( "
\n" ); document.write( "which basically says \"g%28x%29+=+-%28x-1%29\" if \"x+%3C=+1\" OR \"g%28x%29+=+x-1\" if \"x+%3E+1\"
\n" ); document.write( "and for h(x) we have
\n" ); document.write( "
\n" ); document.write( "which basically says \"h%28x%29+=+-%28x-2%29\" if \"x+%3C=+2\" OR \"h%28x%29+=+x-2\" if \"x+%3E+2\"\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "We have three intervals
\n" ); document.write( "Interval A: the interval where \"x+%3C=+1\"
\n" ); document.write( "Interval B: the interval where \"+1+%3C+x+%3C+2\"
\n" ); document.write( "Interval C: the interval where \"x+%3E=+2\"\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "Focus on interval A. Since \"x+%3C=+1\" here this means that \"g%28x%29+=+-%28x-1%29\" and \"h%28x%29=-%28x-2%29\"
\n" ); document.write( "Therefore, \"f%28x%29+=+g%28x%29%2Bh%28x%29=-%28x-1%29%2B%28-%28x-2%29%29=-x%2B1-x%2B2=-2x%2B3\" when \"+x+%3C=+1\"
\n" ); document.write( "In short, \"f%28x%29=-2x%2B3\" when \"+x+%3C=+1\"\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "Now move onto interval B. We have \"+1+%3C+x+%3C+2\". This interval will have us use g(x) = x-1 and h(x) = -(x-2). Add the functions to get
\n" ); document.write( "\"f%28x%29+=+g%28x%29%2Bh%28x%29=x-1%2B%28-%28x-2%29%29=x-1-x%2B2=1\" when \"+1+%3C+x+%3C+2\"
\n" ); document.write( "In short, \"f%28x%29=1\" when \"+1+%3C+x+%3C+2\"\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "Finally interval C. Now \"x+%3E=+2\". For this interval \"g%28x%29=x-1\" and \"h%28x%29=x-2\"
\n" ); document.write( "So, \"f%28x%29+=+g%28x%29%2Bh%28x%29=x-1%2Bx-2=2x-3\" when \"+x+%3E=+2\"
\n" ); document.write( "In short, \"f%28x%29=2x-3\" when \"+x+%3E=+2\"\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "To recap, we found the following
\n" ); document.write( "\"f%28x%29=-2x%2B3\" when \"+x+%3C=+1\"
\n" ); document.write( "\"f%28x%29=1\" when \"+1+%3C+x+%3C+2\"
\n" ); document.write( "\"f%28x%29=2x-3\" when \"+x+%3E=+2\"
\n" ); document.write( "Which can be combined to form the piecewise function
\n" ); document.write( "
\n" ); document.write( "So this proves that overall, \"f%28x%29+=+k%28x%29\" for all real numbers x\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "As visual confirmation, here is a graph showing a side by side comparision of f(x) and k(x). I let f(x) = |x-1|+|x-2| while k(x) is the piecewise function equivalent form. The two function curves are blue and brown respectively. As you can see, they are identical. If you laid them on the same xy coordinate system then you'd have the same graph. One function curve would overlap the other perfectly.
\n" ); document.write( "Note: The graph was created with GeoGebra (free graphing software).
\n" ); document.write( "
\n" );