What's an Extension of a Function? Wikipedia says:

An extension of a function $f$ is a function $g$, such that $f$ is a restriction of $g$.

That's about it. Doing some searches doesn't provide much. I'm not quite seeing the implications or meaning of this.
This came up in a question on the definition of the universal property for groups:

The universal property for a group and generating set is a set of maps from the generating set to a new subset that can be extended to a unique homomorphism from the group to that second subset. Formally, every $ϕ:A→H$ can be extended to $\varphi^∗:G\to H$.

It is mentioned in the answer that:

...[if] $f:A\to H$ is a function then extending $f$ to $G$ simply means finding a function $f':G\to H$ such that $f'(g)=f(g)$ for $g\in A$.

Wondering what this means, if more depth could be gone into. Also wondering when you should extend functions, and how to use it. Not sure what is happening with it in the example.
 A: What is an Extension of a Function?
Suppose that you have a machine which has inputs and outputs.

Which inputs are valid can be narrower than we want it to be.
For example, maybe only whole numbers are allowed as input ($1$, $2$, $981$, etc...).
However, you want to allow inputs to be any decimal number (such as $35.891$).
Sometimes, you want to design a new machine which accepts more inputs than the old/original machine.
That is, you want to construct a function which accepts more inputs than the old function did.
An extension of a function is a function which produces the same output as the old function, as long as you put in one of the old valid inputs.
However, the new function can also accept new inputs which the old function did not use.
Vending Machine Example
Picture a vending machine in your mind which dispenses snacks.
The input to a vending machine is usually money.
Before you or I were born, vending machines only accepted metals coins as input.
You could put dimes, nickles, quarters, etc... into the machine.
However, there are vending machines today which accept coins, paper bills, credit cards, and all sorts of different types of input (money).
Your new vending machine is an extension of the old vending machine.
Extending The Factorial Function to Inputs Which Are Not Whole Numbers
The factorial function is usually denoted by an exclamation mark $(!)$
$4! = 3 * 2 * 1$
$9!= 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1$
In general, for any whole number $k$, $\,\, k! = k * (k-1)!$
Well, what is the factorial of $7.1972371$?
Without extending the factorial-function, it is difficult to say what the factorial of any decimal number is.
The extension of the factorial function which mathematicians use most often is usually called:

*

*"the gamma function"

*The symbol $\displaystyle \Gamma$ is used to denote the gamma function.

The gamma function extends the factorial function to any decimal number.
Extending Addition From Only Two Inputs to More than Two Inputs
Suppose that a computer has a function to compute the sum of two numbers (e.g. $4 + 2$)
However, the computer does not have a function to compute $99 + 2 + 3 + 4 + 5 + 5$.
We can extend addition from two inputs, to an arbitrary (but finite) number of arguments.
Define $\mathtt{SUM}$ as a mapping from $(\mathbb{N})$ such that
    for all non-empty $XS \in (\mathbb{N})$,
        for any $x \in XS,$
            $\mathtt{SUM}(XS) = x + \mathtt{SUM}\left({\dfrac{XS}{\{x\}}}\right)$
   
  and $\mathtt{SUM}(\emptyset) = 0$

For example,
     $\begin{align}
\mathtt{SUM}\{99, 1, 15\} & = 99 + \mathtt{SUM}\{1, 15\} \\  
                          & = (99 + 1) + \mathtt{SUM}\{15\} \\
        & = ((99 + 1) + 15) + \mathtt{SUM}\{\} \\
        & = ((99 + 1) + 15) + 0 \\
\end{align}$
The symbol $(\mathbb{N})$ denotes the set of all subsets of whole numbers.
For example, $\{1, 2, 3, 55, 7512\}$ is a set of whole numbers.
The symbol $\emptyset$ is used by mathematicians to represent a set containing nothing.
$\emptyset$ is like a glass cookie jar having no cookies inside.
It is also like an empty suitcase, empty purse, or empty cardboard box.
The thing represented by the symbol $\emptyset$ is also known as "the empty set"
Extending the Notion of Even and Odd
A whole number $k$ is "even" if and only if $k$ is a multiple of $2$.
For example, $2$, $4$, $10$, and $20$ are all even numbers.
for any $n \in \mathbb{N}$
    $f(n) = \begin{cases}
``\text{is even}",  & \text{if } n \text{ is even} \\
``\text{is odd}", & \text{if } n \text{ is odd} \\
\end{cases}$
What would it mean for $1.59810$ to be "even"?.
Let $XS$ be the set of all decimal numbers $x$ such that there exists a positive whole number $k$ such that $10^{k}*x$ is a whole number.
For example $1.59810$ is in the set named $XS$, because if you multiply $1.59810$ by $10000$, you get a whole number: $15,981$ (fifteen thousand plus some extra stuff)
For any number $X$ is set $XS$, let $\mathtt{rank}(X)$ be the smallest whole number $k$ such that $10^{k}*x$ is a whole number, where zero is included in "the whole numbers"
For example,

*

*$\mathtt{rank}(1.8712) = 4$

*$\mathtt{rank}(1.25) = 2$

*$\mathtt{rank}(999) = 0$

*$\mathtt{rank}(999.1) = 1$

*$\mathtt{rank}(999.12) = 2$

*$\mathtt{rank}(999.1234567) = 7$

*$\mathtt{rank}(1) = 0$

*$\mathtt{rank}(2) = 0$

*$\mathtt{rank}(3) = 0$

*$\mathtt{rank}(821) = 0$
Let $✓$ be a function whose inputs are positive decimal numbers defined as follows:

  For any decimal number $X$ in the set named $XS$,
      $✓(n) = \begin{cases}
``\text{is even}",  & \text{ if } 10^{\mathtt{rank}(x)}*x \text{ is even} \\    
``\text{is odd}", & \text{ otherwise } \\
\end{cases}$

That will not extend the "is_even" function to all decimal numbers, but it is a good start.
If you want any decimal number, including $\pi \approx 3.1459 \dots$, to be allowed as a valid input, then you would have to do some more work.
A: If every boy in a school has a locker number but the girls don't, that's a function from the set of boys to the set of locker numbers. 
If you decide that this is an unnecessarily sexist situation and give the girls a locker number as well, while every boy keeps his, that's an extension of the function.
