The function has an inverse if it is a one-to-one function
We use the horizontal line test to check if the function is a one-to-one function or not
Then it is necessary to use the horizontal line test because if the function is not a one-to-one function there is no inverse to it
The answer is
Yes it is necessary