Piecewise Functions, a la Shmoop.
John Lemon and Yoko Froyo run an unusually successful and longstanding lemonade and yogurt
stand in a highly populated metropolitan area.
It’s the end of a long day, and time to chart the daily earnings.
From 6 AM to noon, John runs the stand.
In order to attract people to the stand, he plays acoustic guitar and sings soothing,
classic rock songs at no extra charge.
He makes about 8 dollars an hour.
Not bad for a lemonade and yogurt stand.
John’s earnings can be represented by the equation f of x equals 8 “x,”…
…where 8 dollars an hour times “x,”… the number of hours worked since 6 AM… will
give us the monetary total.
At noon, John leaves to work on his music, and Yoko takes over the stand until 6 PM.
To attract people to the stand, she does various performance art pieces at no extra charge.
Unfortunately, she doesn’t have as many fans as John.
She makes about 5 dollars an hour.
Yoko’s earnings can be represented by the equation g of y equals 5 “y,” where y
is the number of hours worked since noon.
How do we combine these two equations into one earnings chart?
The answer lies in a piecewise function.
We can create a comprehensive piecewise function that takes into account both John and Yoko’s
total earnings over the course of the day.
Here’s what the function looks like…
F of “x” equals 8 “x” when “x” is greater than or equal to zero, and less
than or equal to 6 since John works from 6 AM till noon...
…AND 8 times 6… that’s John’s 48 dollars from his shift… plus 5 times… x minus
6…
…when “x” is greater than 6 and less than or equal to 12, since the stand closes
at 6 pm, 12 hours after 6 AM.
“x” is equal to the number of hours worked since 6 AM, which is why the second half of
the function…
…which represents Yoko’s earnings…
…contains “x” minus 6.
Her shift doesn’t start UNTIL noon, so the six hours before the switch don’t apply.
And of course, F of “x” is the total earnings of the day.
And now everything can be shown on one chart.
All we do is graph the function.
Both pieces are line segments, so two points per piece are sufficient to graph the function:
For the first line segment for when “x” is greater than or equal to 0 or less than
or equal to 6…
…we can plug in x as 0, to get (0,0) as one endpoint.
To get the other endpoint of the first segment, we can plug in x as 6 to get (6, 48).
For the second line segment for when “x” is greater than 6 and less than or equal to
12…
…we can plug in "x" as 6 to get (6,48) to see where the second piece picks up from the
first.
To get the end point of the last piece, we can plug in 12 into the 8 times 6 plus 5 times…
x minus 6…
…to get 48 plus 5 times 6… 5 times 6 is 30, so 48 plus 30 equals 78.
So our endpoint for the second line segment is (12,78).
Perfect, we can graph it now.
Piecewise functions are just big functions made out of smaller pieces of other functions.
John loves them so much, he even has a song about them.