Defined at zero or not I have what is probably a silly question that I would prefer a formal answer to actually, if possible.  
We are accustomed to taking a function from $\mathbb{R}$ to $\mathbb{R}$ like: $f(x)$ = $\frac{2x}{x}$ and applying some algebraic manipulation, like cancelling the $x$ in the numerator and denominator and arriving at: 
$f(x)$ = $\frac{2x}{x}$  = $2$
Now if we do not simplify and compute $f(0)$ as is, we get $\frac{0}{0}$ which we call "undefined". But if we do simplify i.e cancel the x in the numerator and denominator then we get $f(0)$ = $2$. 
But then in a sense we arrive at "undefined" = $2$, seemingly a contradiction. Furthermore there are functions like g(x) =  $\frac{1}{x}$ that actually ARE undefined at $0$ but how can one be sure there is not some clever algebraic manipulation that would allow use to escape $g(0)$ = "undefined" as in the first case for $f(0)$. 
Could someone please explain why this is not a contradiction? Why can two computations of $f(0)$ yield different "answers" and yet we consider both valid formulae for $f(x)$ in this case? 
I presume the answer is that $f$: $\mathbb{R}$ $\rightarrow$ $\mathbb{R}$ and so we implicity say it must be defined for on all of $\mathbb{R}$. But just giving the function $f(x)$ without information on its domain and range is not sufficient as such a cancellation is only valid for non-zero values. 
Thanks!  
 A: Technically, it is simply not the case that $\frac{2x}x=2$. Those functions are not the same (precisely because they have different behavior at $x=0$).
There are lots of practical situations where doing the technically-incorrect algebraic step of cancelling $\frac{2x}x$ to get $2$ gets us the answer we want. So it's a short cut that is useful in practice. (It's worth deeply thinking about what situations it's useful for and why it's useful; thinking deeply about the logic behind algebraic operations is always educational.)
However, that still doesn't mean that we can derive "undefined${}=2$", because it's not a true mathematical fact to begin with.
A: There's no contradiction, for when you cancel the common factors in $2x/x,$ you're already assuming that $x\ne 0.$ Otherwise that maneuver is invalid. So what you have is that $f(x)=2$ when $x\ne 0.$ Now for $x=0,$ we do not have any value. However, if you want you may give the function any definite value at all to make it defined at all real points. In cases like this we usually extend the function continuously, that is, we stipulate again that $f(0)=2,$ so as to make the resulting function defined. But this depends on what one wants to achieve, etc.
Now your question about $1/x$ should be resolved, since we know that no matter what, $0$ has no reciprocal, so that $g(0)$ has no value, unless again we set a value for it, depending on what we want to do.
