Left inverse

From CS2800 wiki

Given a function [math]f:A \href{/cs2800/wiki/index.php/%E2%86%92}{→} B [/math], it is useful to ask whether the effects of [math]f [/math] can be "undone". A reasonable way to define this is to provide an "undo" function [math]g : B \href{/cs2800/wiki/index.php/%E2%86%92}{→} A [/math] such that [math]g(f(x)) = x [/math] for all [math]x \href{/cs2800/wiki/index.php/%E2%88%88}{∈} A [/math]. Such a function is called a left inverse of [math]f [/math] (so-called because you write it on the left of [math]f [/math]):

Definition: Left inverse
Given a function [math]f : A \href{/cs2800/wiki/index.php/%E2%86%92}{→} B [/math], a left inverse [math]g [/math] of [math]f [/math] is a function [math]g : B \href{/cs2800/wiki/index.php/%E2%86%92}{→} A [/math] satisfying [math]g \href{/cs2800/wiki/index.php/%5Ccirc}{\circ} f \href{/cs2800/wiki/index.php/Equality_(functions)}{=} \href{/cs2800/wiki/index.php?title=Id&action=edit&redlink=1}{id} [/math].

In other words, for all [math]x \href{/cs2800/wiki/index.php/%E2%88%88}{∈} A [/math], [math]g(f(x)) = x [/math].


If [math]f \href{/cs2800/wiki/index.php/Definition}{:=} [/math] Fun-abc-12-a1b2c2.svg and [math]g \href{/cs2800/wiki/index.php/Definition}{:=} [/math] Fun-12-abc-1a2b.svg then [math]f [/math] is a left inverse of [math]g [/math], because

[math]f \href{/cs2800/wiki/index.php/%5Ccirc}{\circ} g \href{/cs2800/wiki/index.php/Equality_(functions)}{=} [/math] Fun-id-12.svg [math]\href{/cs2800/wiki/index.php/Equality_(functions)}{=} \href{/cs2800/wiki/index.php?title=Id&action=edit&redlink=1}{id} [/math]

For the same reason, [math]g [/math] is a right inverse of [math]f [/math].

However, [math]f [/math] is not a right inverse of [math]g [/math] (nor is [math]g [/math] a left inverse of [math]f [/math]) because

[math]g \href{/cs2800/wiki/index.php/%5Ccirc}{\circ} f \href{/cs2800/wiki/index.php/Equality_(functions)}{=} [/math] Fun-abc-abc-aabbcb.svg [math]\href{/cs2800/wiki/index.php/Equality_(functions)}{\neq} \href{/cs2800/wiki/index.php?title=Id&action=edit&redlink=1}{id} [/math]

Finally, if [math]h := [/math] Fun-abc-123-a2b3c1.svg and [math]i := [/math] Fun-123-abc-1c2a3b.svg, then [math]h [/math] and [math]i [/math] are two-sided inverses of each other, because

[math]h \href{/cs2800/wiki/index.php/%5Ccirc}{\circ} i \href{/cs2800/wiki/index.php/Equality_(functions)}{=} [/math] Fun-id-123.svg [math]\href{/cs2800/wiki/index.php/Equality_(functions)}{=} \href{/cs2800/wiki/index.php?title=Id&action=edit&redlink=1}{id} [/math] and [math]i \href{/cs2800/wiki/index.php/%5Ccirc}{\circ} h \href{/cs2800/wiki/index.php/Equality_(functions)}{=} [/math] Fun-id-abc.svg [math]\href{/cs2800/wiki/index.php/Equality_(functions)}{=} \href{/cs2800/wiki/index.php?title=Id&action=edit&redlink=1}{id} [/math]