# X=y%z How to solve for y?

1. Jul 26, 2015

### Superposed_Cat

Hey all, if x=y%z How do i solve for y?

2. Jul 26, 2015

### Mentallic

Take an example:

$$3=12\%9$$

So in this case we have that x=3, z=9, and y=12. But also,

$$3=3\%9$$
$$3=21\%9$$
$$3=-6\%9$$
$$3=(100*9+3)\%9$$

Are you seeing the pattern? Can you develop a simple formula that gives us every possible y value that satisfies this equation?

3. Jul 26, 2015

### Superposed_Cat

y=z*i+x, i is int > 0

4. Jul 27, 2015

### HallsofIvy

Why greater than 0? -6= 3%9 because -6= 3+ (-1)9.

(I would say "-6= 3 (mod 9). "%" is computer code.)

5. Jul 27, 2015

### aikismos

Yes, $y = nz+x$ $∀x,y,z,n ∈ ℤ$ is more inclusive.