Yes. On one level, functions are defined as a subset of the cartesian product of a domain set and a codomain set. In order for two functions to be equal you need to show (among other conditions) set equivalence. In your example, , yet , so .

Your confusion comes from glossing over the understood conventions of algebra. When one uses an algebraic variable in an expression (such as ), this acts as a placeholder for members of a field (usually the field of real or complex numbers). When one evaluates the truth of a statement involving variables, it is understood that the statement should be true for all substitutions of the variables over the understood field. For example, the equation is true for all real numbers substituted for .

On the other hand, the equation does not hold for all real numbers (in particular, the left hand side is undefined when ). Often, when the points where a statement fails are easy to determine, we note the exceptions and continue using the statement. For example, we could say that is true provided . Any further algebraic results using the above statement would continue to have the exception noted.

I think you did something wrong here. But just for the sake of argument, for the rest of the post I will assume that you wrote

Remember that provided and provided .

Yes, exactly. would not be defined if or .

Yes, is a different function from the function (the right hand side is already undefined at ). We might write provided . Another way of is .

I think from here, you should be able to answer the rest of your questions.