Modular equation with complex numbers: given $\displaystyle \Big\vert \frac{z-50}{z-2} \Big\vert = 5$ find $\vert z \vert $ I am asked the following question:

Suppose $z$ is a complex number. Find $\vert z \vert$.
$$\Big\vert \frac{z-50}{z-2} \Big\vert = 5$$

The book's solution:
Initially, I pretty much did the same as the book instructed, using all properties of modulus, substituting $\vert z \vert$ for $z \cdot z^*$ and so on (I'll just place the book's mark scheme):

Second (?) solution: I basically treated $z$ as an unknown:
$$\Big\vert \frac{z-50}{z-2} \Big\vert = 5$$
$$\frac{(z-50)^2}{(z-2)^2} = 25$$
$$z^2 -100z +2500 = 25z^2 -100z+100$$
$$z^2 = 100$$
$$\vert z \vert = 10$$
My question: I found that the answers are the same. But is this method valid in the first place? Is it ok for me to assume and treat z as an unknown variable?
Any help is highly appreciated
The first method looks okay.  The second method is not a correct approach.
$$\left|\frac{z-50}{z-2}\right|^2=\frac{z-50}{z-2} \cdot \frac{\overline{z}-50}{\overline{z}-2}$$
I disagree with the other answers, perhaps because I meta-cheat.
What the OP did, without realizing it, is assume that $z$ maybe expressed as $x + iy$.  The meta-cheating idea, is that if the problem is solvable, then the problem is still solvable if
$$y ~\text{is assumed to equal} ~0.$$
In effect, perhaps without realizing it, the OP treated the problem like a math puzzle rather than a math problem.  It was not a coincidence that the OP's method worked.
There seems to be confusion about the underlying mathematical basis for this specific meta-cheating.
I am asserting that the method is flawless when solving for |z| with respect to the complex variable z, as long as long as any satisfying values for the value to be solved for, (in this case |z|), each occur at least once in whatever
restricted domain that you are exploring.
The only reason that the meta-cheating involves restricting the domain to $\mathbb{R}$ is for ease of use. The principle will mathematically hold, regardless of what restricted domain you investigate, as long as |z| takes on all pertinent values there.
Naturally, the specific meta-cheating process for this problem involves identifying candidate values for z that may not work against the original equation.
Anytime you have a problem asking for you to solve for |z|,
then if there is only one value for |z| to be determined, the method can not fail.  This is because if no real solutions in the meta-cheated equation are uncovered, then you know immediately that in this specific problem, you must abandon the meta-cheating idea.
This answer (in effect) answers why the OP's (invalid) method works.  It is because he restricted the domain to be investigated to $\mathbb{R}$, and because all values to be solved for, |z|, each occurred at least once in the restricted domain.

A comment/question was asked:
For what values of $a,b,c$ will the meta-cheating approach lead to the wrong conclusion re solving for $|z|$ re
$$\frac{|z-a|}{|z-b|} = c.$$
Exploring, I squared both sides.  This may result in candidate values for $z$ that do not solve the original equation.
This resulted in
$$|z|^2(c^2 - 1) + 2\text{Re}(z)(a - bc^2) + (b^2c^2 - a^2) = 0.$$
In order for the meta-cheating idea to fail:
(1) 
There must be at least two distinct values for |z|, such that each of them will have at least one underlying value of $z$ that satisfies the equation.
(2) 
At least one of the two distinct values for |z| must never occur in the restricted domain of $z \in \mathbb{R}.$
Looking at the general problem, I actually have no opinion when the meta-cheating would fail, re the above two conditions both occurring.
Edit
However, given the latest downvote, I really can't help myself here:
In the above equation, which explored when the meta-cheating would or would not fail with respect to the equation
$$\frac{|z-a|}{|z-b|} = c$$
It is immediate that when $(a - bc^2) = 0$, which is the case in the OP's problem, you are mathematically guaranteed that there can only be one satisfying value for $|z|$, which is the value being asked for.
In such a situation, per discussion previously in this answer, the meta-cheating approach can not fail.
Come to think of it, when $(a - bc^2) = 0$, if the problem has any solutions at all, the locus of points $z$ that provide the appropriate value of $|z|$ will have to be a complete circle centered at the origin, which (further) guarantees that the locus of points will cross the $x$-axis.