# How do I “stretch” and “compress” a piecewise function?

I have Googled a few times and experimented on Desmos, but both attempts were to no avail, and now I come here. How is a piecewise function transformed to be "stretched" or "compressed"? What about other transformations?

• Just do the usual techniques on each piece separately. Nothing more, nothing less. – tilper Jun 24 '16 at 23:50
• Yes, but do I multiply the x-value for the conditions? The values? Both? – asher drummond Jun 24 '16 at 23:52
• If you are stretching / compressing vertically, nothing happens to the x values. If you are stretching horizontally, then they distort to the same degree everything else distorts. – Doug M Jun 24 '16 at 23:54
• Okay thanks, I get it now. – asher drummond Jun 24 '16 at 23:57
• I see what you're getting at. See my answer. – tilper Jun 25 '16 at 0:00

I see what you're getting at based on our comment discussion now.

The conditions also change.

For example, say we have $f(x) = x^2$ if $x > 10$. Then $f(2x) = (2x)^2$ if $2x> 10$. (Other pieces are irrelevant for this discussion and the same thing happens to them, so it's sufficient to consider one piece.)

Similar reasoning for horizontal translations.

The explanation behind this is... Think of our example function $f$ in words like this:

$f$ of the input is equal to the input squared, if the input is greater than 10.

Now just replace the input with $x$ to get our original function. Replace the input with $2x$ to get the compressed function.