We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

In case it is useful for someone, in the context of this challenge, a valid function is that which for a given input, ALWAYS gives the same output.

VALID Function

Given a function f() that functions as:

f(1)=1f(2)=2f(3)=3f(2)=2f(4)=1000

It is considered VALID, as outputs are always in a 1:1 relation with inputs, even although we don't know the exact way the relationship (function) works (i.e. we got no idea how f(4) gives 1000).

INVALID Function

A function g() which functions as follows:

g(1)=1g(2)=333g(3)=89g(2)=777g(4)=1000

The above function g, is NOT VALID, since, for input 2, we get two different results, first 333, then later we get 777.

NOTE : It is worth noting that multiple inputs may give the same output:

Good explanation. Another way to think about it that helps me (though if it doesn't help you, probably best just to forget about it) is to consider the result if I graphed the function. So if the x axis is x, and the y axis is f(x), then for a valid function, there should be no place along the x axis where I could draw a vertical line directly down or up and have that line intersect the function's curve/line in more than one place.

Using the examples given above, if you graphed the valid function outputs, you would see that there is only one output for each x input (i.e. only one spot on the graph for each x), and thus I cannot draw a vertical line intercepting the function in more than one place. That is NOT the case however with the invalid input, as I could draw a line and intercept the function's output for 2 at two places.

I hope this helps to clarify things for someone :)

## Functions or Not?

You are viewing a single comment's thread. Return to all comments →

## Might be helpful to know ...

In case it is useful for someone, in the context of this challenge, a valid function is that which for a given input, ALWAYS gives the same output.

## VALID Function

Given a

`function f()`

that functions as:It is considered

VALID, as outputs are always in a 1:1 relation with inputs, even although we don't know the exact way the relationship (function) works (i.e. we got no idea how f(4) gives 1000).## INVALID Function

A

`function g()`

which functions as follows:The above function g, is

NOT VALID, since, for input 2, we get two different results, first 333, then later we get 777.NOTE: It is worth noting that multiple inputsmaygive the same output:Would still be a valid function.

Nice explaination. I was confused by this notion too.

This practice's test cases do not concern about f(2)=2 f(3)=2 or f(1)=99 f(2)=99 f(3)=99

Thank you, your explanation makes a whole lot more sense than the one which is provided.

Good explanation. Another way to think about it that helps me (though if it doesn't help you, probably best just to forget about it) is to consider the result if I graphed the function. So if the x axis is x, and the y axis is f(x), then for a valid function, there should be no place along the x axis where I could draw a vertical line directly down or up and have that line intersect the function's curve/line in more than one place.

Using the examples given above, if you graphed the valid function outputs, you would see that there is only one output for each x input (i.e. only one spot on the graph for each x), and thus I cannot draw a vertical line intercepting the function in more than one place. That is NOT the case however with the invalid input, as I could draw a line and intercept the function's output for 2 at two places.

I hope this helps to clarify things for someone :)

Thanks! I just thought I missed some math knowledge before reading your comment... what a pity, I thought I could learn something new.