randRange( -8, 8 ) randRange( -8, 8 ) abs ( Y_ORIG ) < 5 ? randRangeNonZero( -1, 1 ) : -abs ( Y_ORIG )/ Y_ORIG X_ORIG > 0 ? randRange( -6, -1 ) : randRange( 1, 6 ) randRangeNonZero(-1, 1) randRangeNonZero( -6 , 6 )

`\color{red}{f(x)}` is graphed in red.

`\color{blue}{g(x)}` is graphed in blue.

What is `\color{blue}{g(x)}` in terms of `\color{red}{f(x)}`?

graphInit({ range: 10, scale: 20, labelStep: 1, axisArrows: "<->" }) style({ stroke: "red", strokeWidth: 2, arrows: null }); plot( function( x ) { return UP_ORIG * pow(( x + X_ORIG), 2 ) + Y_ORIG; }, [-10, 10]); style({ stroke: "blue" }); plot( function( x ) { return FLIP * UP_ORIG * pow(( x + X_ORIG + X_SHIFT), 2 ) + FLIP * Y_ORIG + Y_SHIFT; }, [-10, 10]);

`expr(["+",["*", FLIP, ["*", "f", ["+","x", X_SHIFT]]],Y_SHIFT])`

• `expr(["+",["*", FLIP, ["*", "f", ["+","x", X_SHIFT]]],-Y_SHIFT])`
• `expr(["+",["*", FLIP, ["*", "f", ["+","x", -X_SHIFT]]],Y_SHIFT])`
• `expr(["+",["*", -FLIP, ["*", "f", ["+","x", X_SHIFT]]],Y_SHIFT])`
• `expr(["+",["*", FLIP, ["*", "f", ["+","x", -X_SHIFT]]],-Y_SHIFT])`

To get from `f(x)` to `g(x)`, first "flip" `f(x)` vertically by multiplying by `-1`, giving `-f(x)`.

style({ stroke: "purple" }); plot( function( x ) { return FLIP * UP_ORIG * pow(( x + X_ORIG ), 2 ) - Y_ORIG; }, [-10, 10]);

Shift the function `-f(x)` (Y_SHIFT > 0 ? "up " : "down ") + abs(Y_SHIFT) (abs(Y_SHIFT) == 1 ? "unit" : "units"), giving `expr(["+",["*", FLIP,"f(x)"], Y_SHIFT])`.

style({ strokeWidth: 2, stroke: "green", arrows: "->", strokeDasharray: "- " }); plot( function( x ) { return FLIP * UP_ORIG * pow(( x + X_ORIG ), 2 ) + FLIP * Y_ORIG + Y_SHIFT; }, [-10, 10]); strokeDasharray: "- " style({ strokeWidth: 2, strokeDasharray: "" }); path([ [-X_ORIG, FLIP * Y_ORIG], [-X_ORIG, FLIP * Y_ORIG + Y_SHIFT] ]);

Now shift the function `expr(["+",["*", FLIP,"f(x)"], Y_SHIFT])` (X_SHIFT > 0 ? "left " : "right ") + abs(X_SHIFT) (abs(X_SHIFT) == 1 ? "unit" : "units"), giving `expr(["+",["*", FLIP, ["*", "f", ["+","x", X_SHIFT]]], Y_SHIFT])`.

We now know that `g(x)` = `expr(["+",["*", FLIP, ["*", "f", ["+","x", X_SHIFT]]],Y_SHIFT])`.

style({ stroke: "blue", strokeWidth: 2, strokeDasharray: "" }); path([ [ -X_ORIG, FLIP * Y_ORIG + Y_SHIFT ], [ -X_ORIG - X_SHIFT , FLIP * Y_ORIG + Y_SHIFT] ]);