TITLE: Mystery in proof of Euclid Elements Book 7 Proposition 20
QUESTION [5 upvotes]: Below is a screen-shot of a video about the proof of Proposition 20 of Book VII of the elements. There is one step that I don't understand and seems to be completely glossed over by the proof. This is not a criticism of the video: many written sources around the internet give the same steps without the pictures, leaving me with the same problem. If anything the illustration in the video helped me pin-point exactly what my problem is.
The statement of the proposition is this:

Suppose $A$ and $B$ are positive integers and $CD$ and $EF$ are positive integers as well such that $A : B = CD : EF$ and moreover $(CD, EF)$ are the smallest pair $(x, y)$ such that $x : y = A : B$. Then $CD$ divides $A$ and $EF$ divides $B$.

The proof, as I understand it, goes as follows. We give a proof by contradiction, starting with numbers $A$, $B$, $CD$ and $EF$ such that $A : B = CD : EF$ and $CD < A$ but $CD$ does not divide $A$

There exist natural numbers $p$ and $q$ such that $q$ divides $A$ and $CD = p (A/q)$, or, as the video puts it: $CD = (p/q)A$. Since $CD < A$ we have $p < q$. All this is off course completely uncontroversial.

The assumption (that eventually must lead to a contradiction) that $CD$ does not divide $A$ translates in this language to $p > 1$.
The video uses, as an example $q = 3$ and $p = 2$ but explains that these are arbitrary examples and other numbers would be good as well
The quantity $(1/q)A$ is drawn in red in the picture


The point $G$ on segment $CD$ is defined by $CG = (1/q)A$.

By definition of $p$ we see that $G$ lies on $1/p$'th of $CD$ and since (by assumption) $p > 1$ we have that $G \neq D$ and $CG < CD$.


Next step: now that we have the number $q$ we can talk/think/reason about the mystery quantity $(1/q)B$.

This drawn green in the picture
Since, by definition, the mystery quantity fits exactly $q$ times in $B$, some completely standard and easy and innocent reasoning about ratios tells us that it fits exactly $p$ times in $EF$.


The point $H$ on segment on $EF$ is defined by $EH = (1/q)B$, so $EH$ is what I call the mystery quantity above.

Since moreover $p > 1$ we have that $H$ is not equal to $F$ and the mystery quantity $EH$ is smaller than $EF$.


Third step: by some completely standard and innocent reasoning that Euclid still manages to make sound complicated we conclude that $CG : EH = A : B$.

Final step: since $CG < CD$ and $EH < EF$ we get a contradiction with the initial assumption that $(CD, EF)$ is the smallest pair of numbers in ration $A : B$.


Now my question:

What tells us that the mystery quantity $(1/q)B$ is an integer???

Nothing in the proof depends on $EH$ being an integer except for the final step. We can still find that $EH < EF$ and that $CG : EH = A : B$ only now the 'contradiction' becomes the claim that some fraction is smaller than the smallest integer with a certain property which is of course no contradiction at all.
However if the proof does indeed define the mystery quantity $EH$ as $(1/q)B$ then there is no reason to assume that it is an integer, unless some extra proof that $q|B$ is provided. I can't find such extra proof in the video but maybe I am misinterpreting something?

The full video can be found here
PS Of course I can come up with a proof that $q|B$ (or of the full proposition) using the Fundamental Theorem of Arithmetic, but this proposition is used by Euclid as part of the proof of that theorem. So 'Well, duh, everybody knows about unique factorization into primes so no need to elaborate on this' could not have been what went through Euclid's head when putting this proof in the way he did.

REPLY [2 votes]: It seems the best answer is given in the article posted in a comment:
Did Euclid Need the Euclidean Algorithm toProve Unique Factorization?
By David Pengelley and Fred Richman, American Mathematical Monthly 113, March 2006
For the benefit of future readers I promote the link from a comment into an answer and also I'll summarize the main point here, but I warmly recommend everybody to read it. There is a lot of interesting stuff in there!
Answer to the original question, based on the article:
On the one hand: yes I do miss something and so does the video. Namely: the definition of $A : B = C : D$ that Euclid uses is not the same as what we think.
I interpreted it as $A/B = C/D$. The video seems to interpret it as $A/C = D/B$. Both interpretations are of course equivalent.
However, according to the article, the expression $A : B = C : D$ means something stronger namely
There exist m, n, X, Y such that
$$A = mX, B = nX, C = mY, D = nY.$$
(Capitalization is mine but has actual meaning here (and to Euclid): we think of capital letters as length of line segments and of small letters as actual numbers counting the discrete number of times one segment fits into another. So small letters are actual natural numbers and capital letters are real numbers that can be thought of as natural numbers because we all take them from a set of real numbers that have a common 'unit' divisor)
Now with this definition the problem of my original question disappears.
On the other hand: while it is clear that $A : B = C : D$ implies $AD = BC$ the implication in the other direction is not clear at all (without using unique factorization) and we need both directions in the proof. (In my original part I filed this under 'completely standard and innocent manipulation of proportions' but with the new, stricter definition of $A : B = C : D$ it is neither standard nor innocent anymore.)
Euclid does realize it and makes a separate earlier proposition about this, proposition 19, stating that $A : B = C : D$ is equivalent to $AD = BC$.
However: the proof of that proposition contains a (rather subtle) mistake, explained in the article.
So summarizing: Euclid's proof of proposition 20 is wrong, but the gap is not the glaring oversight that I call out in the original post (which is covered by using a different definition of proportionality) but a more subtle one in the proof of the previous proposition that asserts that the two definitions are equivalent. As the article points out: they are equivalent for natural numbers, but not in more general contexts where Euclid's would be proof would still apply.
The authors of the article propose a way of 'fixing' the proof of proposition 19 using an interesting consequence of the Euclidean algorithm (that also appears in Euclid book VII), namely that every common divisor of two numbers is also a divisor of their greatest common divisor.
However when one is 'merely' interested in fixing proposition 20 instead, I think the argument in the other answer is much simpler (using division with remainder, which is of course the main ingredient of Euclid's algorithm, directly rather than indirectly).