Concept
Function, in mathematics, an expression, rule, or law that defines a relationship between one variable (the independent variable) and another variable (the dependent variable).
A function must have unique output.
For option A, the input -2 has two outputs 6 and -2. Hence it's not a function.
For option C, input 4 has three outputs 0, 1, 3 and 2. Hence it's not a function.
For option D, the input 10 has two outputs 8 and 10. Hence it's not a function.
Option B is a function