Is $\frac{1}{x}$ a function? Consider $f(x)=\frac{1}{x}$ defined on set of real numbers.
If every element in domain has image, then above relation is said to be a function.
But for $x=0$,  $f(x)=\text{infinity}$.
Does it mean that $0$ doesn't have image? And hence $\frac{1}{x}$ not a function?
 A: You are correct, in that a function must be defined for every element in its domain, and that therefore you cannot create a function $f:\mathbb{R}\to\mathbb{R}$ defined by $f(x)=\frac{1}{x}$, because $\frac{1}{0}$ is undefined.
You can however create a function $g:\mathbb{R}\setminus\{0\}\to\mathbb{R}$ defined by $g(x)=\frac{1}{x}$, because we have removed the problematic element $0$ from the domain.
You can also create a function $h:\mathbb{R}\to \mathrm{P}^1(\mathbb{R})$ defined by $h(x)=\frac{1}{x}$, where $\mathrm{P}^1(\mathbb{R})=\mathbb{R}\cup\{\infty\}$ is the real projective line (Wikipedia), which has the element $\infty$ available to be the output of $h(0)$.
A: Function is a set of ordered pairs $(x,y)$ where $x$ and $y$ depends to sets $X$ and $Y$ respectively. If your definition satisfies this, it is enough. So strictly speaking, if you  say, that set $Y$ is a real numbers extended with at least one element "infinity", it is a function. Otherwise, you can say it is a function, but not defined for zero.
A: A function should be defined by 
(a) $f(x)$ and
(b) the domain upon which you want to consider the function
The reason for also including the domain is that many functions are undefined at points where the function is discontinuous.
You could instead define your function f(x) for all real numbers as:
$f(x) = 0$ when $x = 0$
$f(x) = 1/x$ when $x>0$ or $x<0$
