This exercise covers inverses of linear functions.
f(x) = M_X + B
for all real numbers.
What is f^{-1}(x)
, the inverse of f(x)
?
graphInit({
range: 10,
scale: 20,
tickStep: 1,
labelStep: 2,
axisArrows: "<->"
})
// draw the function
style({
stroke: "#a3a3ff",
strokeWidth: 2
}, function() {
plot( F, [ -10, 10 ] );
});
X_OVER_M + MINUS_B_OVER_M
expr([ "+", M_X, -B ])
expr([ "+", M_X, B ])
expr([ "+", B_X, M ])
expr([ "+", M_OVER_X, B ])
expr([ "+", X_OVER_M, B ])
expr([ "+", X_OVER_M, -B ])
X_OVER_M + MINUS_M_OVER_B
X_OVER_M + PLUS_B_OVER_M
X_OVER_NEG_M + MINUS_B_OVER_M
X_OVER_NEG_M + PLUS_B_OVER_M
y = f(x)
, so solving for x
in terms of y
gives x=f^{-1}(y)
f(x) = y = expr([ "+", M_X, B ])
expr([ "+", "y", -B ]) = M_X
Y_OVER_M + MINUS_B_OVER_M = x
x = Y_OVER_M + MINUS_B_OVER_M
So we know:
f^{-1}(y) = Y_OVER_M + MINUS_B_OVER_M
Rename y
to x
:
f^{-1}(x) = X_OVER_M + MINUS_B_OVER_M
var pos = function( n ) {
if ( n >= 1 ) {
return "below right";
} else if ( n > 0 ) {
return "below";
} else if ( n > -1 ) {
return "above";
} else {
return "above right";
}
},
fPos = pos( M ),
fInvPos = pos( 1 / M );
// plot function inverse
style({
stroke: "#ffa500",
strokeWidth: 2
}, function() {
plot( F_INV, [ -10, 10 ] );
});
if ( M !== -1 && ( M !== 1 || B !== 0 ) ) {
// label f
style({
color: "#a3a3ff",
strokeWidth: 1
}, function() {
label( labelPos( F ), "f(x)", fPos );
});
// label f_inv
style({
color: "#ffa500",
strokeWidth: 1
}, function() {
label( labelPos( F_INV ), "f^{-1}(x)", fInvPos );
});
}
style({
stroke: "#aaa",
strokeWidth: 2,
strokeDasharray: "- "
}, function() {
plot( function( x ) { return x; }, [ -10, 10 ] );
});
Notice that f^{-1}(x)
is just f(x)
reflected across the line y=x
.