About free and bound variables I am currently learning about first order logic, and as an exercise was asked to provide free and bound variables in the following formula:
$$(\exists x P(y,y) \implies \exists y P(y,z))$$
I'm currently confused on the following: the term $P(y,y)$ clearly has $y$ as a free variable, while $\exists y P(y,z)$ clearly has it as a bound variable.
From definition, it should be that in the formula above, $y, x$ are both bounded and $z$ is free. However, this does not convey that if I were to do a "change of variables" to $(\exists x P(k, k) \implies \exists y P(y,z))$, then $x, y$ would be bound and $k, z$ would be free, which means that the number of free variables actually changed for formulas that are actually "equivalent" (since both $P(y,y)$ and $P(k,k)$ are referring to a constant, rather than a variable).
I am also having trouble understanding what the full parenthetization of this expression would be: $(\exists x (P(y,y) \implies (\exists y P(y,z))))$ or $((\exists x P(y,y)) \implies (\exists y P(y,z)))$. Both would a priori be valid, and even though it doesn't really change anything in this case (since $x$ is not mentioned within the formula that is being quantified), I'm curious.
 A: An occurrence of a variable $x$ is said to be bound in a well-formed formula $\mathcal{B}$ if either it is the occurrence of $x$ in a quantifier "$\forall x$" or "$\exists x$" in $\mathcal{B}$ or it lies within the scope of a quantifier "$\forall x$" or "$\exists x$" in $\mathcal{B}$. Otherwise, the occurrence is said to be free in $\mathcal{B}$. (Mendelson 2015, p.49)
According to this (standard) definition, then, the first and second occurrences of $y$ in $(\exists xP(y,y)\Rightarrow \exists yP(y,z))$ are free, just as the single occurrence of $z$ is free; and the third occurrence of $y$ is bound, just as the single occurrence of $x$ is bound. 
Since a free variable may be substituted for a fresh term (a new constant, a new variable, or a new function) following a simple algorithm (p.50), you are right so far as replacing the first and seccond occurrences of $y$ with a constant $k$. Or at least that's what I made up from your entry.
On the other hand, the standard decreasing order of strenght of the connectives of first-order logic is (p.48): 


*

*$\neg$

*$\wedge$

*$\vee$

*$\forall$ or $\exists$

*$\Rightarrow$

*$\Leftrightarrow$


Given that, it is easy to see that $(\exists xP(y,y)\Rightarrow \exists yP(y,z))$ has its parentheses where it should. Parenthetization, as you call it, is not a matter of checking if a different placing of the parentheses woulth affect the meaning of a formula; one has a hierarchy of connectives to follow.
Mendelson, E. (2015): Introduction to Mathematical Logic (6th edition). CRC Press.
A: The problem is that you are confusing what a free variable is. There are two $y$s in that formula. One is bound and the other is free. If you get often confused by this, I would suggest changing the variable names so that you end up with an equivalent formula, that doesn't repeat variable names.
In your example that would be:
$$(\exists x P(y,y) \implies \exists y'(y', z))$$
Note that this formula is equivalent to the one you gave, only that now it is much clearer what the answer is. 
If you don't want to change the name of the variables, the correct answer would be to say that in the antecedent the variable $y$ is free, and in the consequent the variable $y$ is bound. Note that those are different variables, even though they have the same name.
About the parenthetization, both you said are fine, as the given parenthetization is ambiguous. One would guess the full parenthetization is the second one you gave, but it depends on how you defined operator precedence.
