Why are we able to use a particular value and assume that it applies to all other cases in algebra? I was working on a question and a though came across my mind.
In the question, we had to prove that if n is odd, the gcd(3n, 3n + 2) = 1. So what I did was I said let a = gcd(3n, 3n + 2). Then we know a | 3n and a | 3n + 2 so a must divide any linear combination of 3n and 3n + 2, i.e., a | y(3n) + z(3n+2). Now, suppose y =-1 and z = 1 then a | 2 and so a must only equal 1 as n is odd and so a ≠ 2.
My question is, why are we allowed to take a particular value of y = -1 and z =1 and say that a divides a particular linear combination and then say that the rule that comes from that particular case, applies to all other cases? I.e., why can we say that because the a | 2 and so a must equal 1, then the gcd = 1. What if the linear combination was divisible by some other value that also divides 3n and 3n + 2?
Because I know that it does work through trial and error of various values, but I want to know why. Is there some sort of mathematical principal I am unaware of?
If someone could shed some light on this, it'd be greatly appreciated.
Thank you in advance.
P.s.My professors working out has been attached below.


*Prove that if n is odd, then gcd(3n,3n+2)=1. What if n is even?

Solution. Let d = gcd(3n,3n + 2). Since d | 3n and d | 3n + 2, it follows that d | (3n+2)−3n = 2. Since the only divisors of 2 are 1 and 2, it follows that d = 1 or 2. But if n is odd, then 3n is also odd, so we cannot have d=2(since d|3n). It follows that d = 1 if n is odd. (If n is even, then 2 divides both 3n and 3n+2, so d = 2 in this case.)
 A: This is something that might in some spaces be called the "axiom schema of replacement", and it boils down to:

*

*If a statement $P(x)$ is true for all values of $x$, then if you choose a value of $x$ then $P$ must be true when you substitute that value in.

It relates to proof by contradiction - if there is a value of $x$ you can choose that makes $P(x)$ false, then clearly $P(x)$ is not true for every value of $x$.
In this case, it means that since $a$ divides every linear combination of $3n$ and $3n+2$, then if we choose the most restrictive linear combination possible it will still be true that $a$ divides it. And since we happen to be able to make the value $(3n)(-1) + (3n+2)(1) = 2$, we know that $a$ still has to divide this linear combination, otherwise it doesn't divide all of them.
It doesn't matter if $a$ divides every other linear combination, because the theorem isn't "The GCD divides every linear combination except maybe one or two" - either it divides anything you can imagine, or it wasn't actually the GCD to begin with.
