Is there difference between how we treat 'free variable' in basic logic and the kind we come across in elementary mathematics? This question may come across as quite contrived so let me give you an example we might find in a typical (simple) example, let $x$ and $y$ be elements of the reals (they can be considered for all values in the reals) for example for a well defined $f$ we might have $y=f(x)$ which means for every admissible value of $x$ there exists a value of $y$ and they can form a set of pairs (in this case, the graph of $f$) forming the set: $[(x,y)|y=f(x)]$.
In this case we have limited our values such that $y=f(x)$ is always true, for every $x$ we must consider a certain $y$ and we have no freedom to change this.
In the case of the basic quantification logic I've done it seems different for proper 'free variables' for free variables we denote a domain of discourse $D$ and each variable is free to vary inside it, for example $x$ and $y$ are now free to vary however we can still have $y=f(x)$ but this becomes a subset of the possibilities of values for $x$ and $y$, now we can define something like $y=f(x)$ and consider the values of $x$ and $y$ that make it true, such as proving the existence of at least one pair in the graph by writing:
$∃(y)∃(x)(y=f(x))$
we can also say:
$∀(x)∃!(y)(y=f(x))$
And with the graph of the function, $G_f$
$∀((x,y)∈G_f(y=f(x))$
Is there a difference here between the first and second case? Can we make a distinction between a 'free variable' and an elementary variable?
 A: Assuming $f$ is defined elsewhere, and we know it is a function, the 3 examples you give have the following meanings:

*

*$\exists y, \exists x, y=f(x)$ means "domain of $f$ includes at least one element, which I call $x$, and the image of $x$ by $f$ is $y$.

*$\forall x, \exists! y, y=f(x)$ means that for all $x$, there is one and only one image by $f$, which we call $y$. It is somewhat clumsy because $x$ is not restricted at all, so if we don't assume that $x$ is restricted to domain of $f$, it is false. And if we assume $x$ is restricted to domain of $f$, it is a tautology, $f$ being a function. One last interpretation would be: for all $x$ in the implicit set I am currently working in (e.g. $\mathbb{R}$) , there is a unique image by $f$; which means: $f$ is defined everywhere in our implicit working set.

*$\forall (x,y) \in G_f, y=f(x)$, assuming $G_f$ is defined elsewhere, is a tautology if $G_f$ is defined as all pairs of $(x, f(x))$.

A "free variable" has a precise technical meaning: a variable is free in an expression if its quantification does not appear in the expression. But it still needs to appear elsewhere in the mathematical discourse. See free and bound variables in Wikipedia.
More generally, if you want to dig this subject, you should define a context, i.e. what logic rules you are using, etc. The answer should then come from the context. Usually we do maths with a vague/sloppy notion of what a variable is, but this does not mean variable usage has never been studied. You could look at various formal logical systems, proof assistants (e.g. Coq), at programming languages especially the concept of referential transparency, etc.
Moreover, a large part of lambda calcules is just about dealing with variables, and the Wikipedia's article is very instructive; it shows there are many subtle details for variable management to be done right. A positive aspect is that all this is used in programming languages, and programming languages work, so there is a very strong basis, as well as a very strong community specialized in these topics. There are many points of contact between the math logic community and the computer science community, notably proof assistants.
