• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 03:01
CEST 09:01
KST 16:01
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Team Liquid Map Contest #22 - The Finalists13[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy21
Community News
2026 GSL Season 1 Qualifiers11Maestros of the Game 2 announced32026 GSL Tour plans announced10Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid20
StarCraft 2
General
https://www.facebook.com/QinuxFootRevitaReviews/ Team Liquid Map Contest #22 - The Finalists Weekly Cups (April 6-12): herO doubles, "Villains" prevail MaNa leaves Team Liquid Oliveira Would Have Returned If EWC Continued
Tourneys
2026 GSL Season 1 Qualifiers Sparkling Tuna Cup - Weekly Open Tournament Master Swan Open (Global Bronze-Master 2) SEL Doubles (SC Evo Bimonthly) $5,000 WardiTV TLMC tournament - Presented by Monster Energy
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 521 Memorable Boss The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Pros React To: Tulbo in Ro.16 Group A ASL21 General Discussion BW General Discussion [BSL22] RO32 Group Stage
Tourneys
[ASL21] Ro16 Group B Small VOD Thread 2.0 Korean KCM Race Survival 2026 Season 2 [BSL22] RO32 Group D - Sunday 21:00 CEST
Strategy
Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Battle Aces/David Kim RTS Megathread Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Reappraising The Situation T…
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1857 users

I dont understand mod

Blogs > exeexe
Post a Reply
1 2 Next All
exeexe
Profile Blog Joined January 2010
Denmark937 Posts
August 30 2010 01:19 GMT
#1
i dont understand mod. Can someone explain what it is?

mod is so much easier

8 = 2 mod 6.
And it becomes 2^n - 2^n mod 6 = 0
and therefore is divisible by 6


This is from another post where i saw it the first time and im like huh?

So imagine you have any 2 arbitrary numbers x and y and y cant be 0 and you have the following task:
Find out if x is divisable with y, how can you do that using mod?


*
And never forget, its always easier to throw a bomb downstairs than up. - George Orwell
infinitestory
Profile Blog Joined April 2010
United States4053 Posts
Last Edited: 2010-08-30 01:25:11
August 30 2010 01:24 GMT
#2
Two numbers a and b are congruent modulo x, if and only if a-b is a multiple of x. Imagine a number line. Only it's been wrapped into a number circle. In mod 6, you wrap a number circle so that 6 and 0 are in the same place, 7 and 1 are in the same place, etc. The residue of a number modulo x is its remainder when divided by x.
Translator:3
blankspace
Profile Blog Joined June 2010
United States292 Posts
August 30 2010 01:25 GMT
#3
mod is an equivalence relation. a=b mod m is equivalent to (a-b) is divisible by m.
Mod is just a notation but a useful one. To show 8^n congruent to 2^n mod 6 you can use the binomial theorem or subtract and factor.
Hello friends
brian
Profile Blog Joined August 2004
United States9639 Posts
Last Edited: 2010-08-30 01:27:20
August 30 2010 01:26 GMT
#4
lol (at the responses. need to make it simpler imo.)

take a number X
X mod Y is the remainder when x is divided by Y.

32 MOD 5
divide 32 by five
the remainder is 2
32 MOD 5 =2
palanq
Profile Blog Joined December 2004
United States761 Posts
Last Edited: 2010-08-30 01:41:17
August 30 2010 01:39 GMT
#5
right so if

x mod y

equals zero, then x* is divisible by y*

edit: -_-;;
time flies like an arrow; fruit flies like a banana
infinitestory
Profile Blog Joined April 2010
United States4053 Posts
Last Edited: 2010-08-30 01:42:08
August 30 2010 01:40 GMT
#6
EDIT: ok
Translator:3
Axiom0
Profile Joined March 2010
63 Posts
August 30 2010 01:51 GMT
#7
The reason why you don't understand the quoted part is because it's unjustified and skips a lot of steps. If you don't understand what he posted it's because its just sloppy mathematics and not really a fault on your part.

Also mod is technically not an operator like Gene described it as, although it is sometimes used that way. It's really an equivalence relation as blankspace described.

As an answer to your other question. If x = 0 mod y, then y divides x-0 by definition (so y divides x). Using mod doesn't really give you much in that situation.
Xeofreestyler
Profile Blog Joined June 2005
Belgium6775 Posts
August 30 2010 02:02 GMT
#8
for some reason I really like modulo
maybe because it is used in arnold's cat map
http://en.wikipedia.org/wiki/Arnold's_cat_map
Graphics
Emperor_Earth
Profile Blog Joined April 2009
United States824 Posts
August 30 2010 02:04 GMT
#9
% = modulus (mod)

If 10/3 has a remainder of 1, then 10 % 3 = 1.

10 / 3 = 3 R1 :. 10 % 3 = 1
4 / 2 = 2 R0 :. 4 % 2 = 0
6 / 200 = 0 R6 :. 6 % 200 = 6
@Emperor_Earth ------- "Amat Victoria Curam."
infinitestory
Profile Blog Joined April 2010
United States4053 Posts
August 30 2010 02:15 GMT
#10
On August 30 2010 10:51 Axiom0 wrote:
The reason why you don't understand the quoted part is because it's unjustified and skips a lot of steps. If you don't understand what he posted it's because its just sloppy mathematics and not really a fault on your part.

I wouldn't go so far as to call it "unjustified." Proving a = b (mod m) implies a^n = b^n (mod m) is not difficult in any way, although it is true that 8 and 2 are not interchangeable mod 6. x^8 and x^2 are not always congruent mod 6, for example.

On August 30 2010 10:51 Axiom0 wrote:
Also mod is technically not an operator like Gene described it as.

sidenote: modulo (%) is an operator in computer science only.

Translator:3
hypercube
Profile Joined April 2010
Hungary2735 Posts
August 30 2010 02:54 GMT
#11
A lot of the answers use language that is probably confusing to anyone who doesn't already know what mod is.

2 mod 6 just means the remainder of 2 diveded by 6.

i.e
5 mod 3 = 2
7 mod 2 = 1

etc.

Find out if x is divisable with y, how can you do that using mod?


x is divisible by y if x mod y = ?

+ Show Spoiler +
x mod y = 0


The important facts about modulus that it's in some sense "compatible" with addition and multiplication. I.e if you know the values of a mod c and b mod c you also know the values of (a+b) mod c and ab mod c. You don't actually need to know the exact values of a and b just their remainder when divided by c.

Specifically, you just add up (or multiply) the remainders and take their remainder again and you've got the remainder of the sum (or multiple).



"Sending people in rockets to other planets is a waste of money better spent on sending rockets into people on this planet."
exeexe
Profile Blog Joined January 2010
Denmark937 Posts
August 30 2010 06:29 GMT
#12
So what is like

x^2 mod x^(1/2) = x^2 mod sqrt(x) = ?
And never forget, its always easier to throw a bomb downstairs than up. - George Orwell
Severedevil
Profile Blog Joined April 2009
United States4839 Posts
August 30 2010 23:48 GMT
#13
On August 30 2010 15:29 exeexe wrote:
So what is like

x^2 mod x^(1/2) = x^2 mod sqrt(x) = ?

If sqrt(x) is a positive integer, the answer is 0, because x^2 = (sqrt(x))(sqrt(x))(x) which is a multiple of sqrt(x).

However, mod is only an operator if you're programming. If you're doing math, you instead say that "x^2 and 0 are congruent [under] mod sqrt(x)." That way, you can also assert that 31 is congruent to 6 under mod 5, because they both have the same remainder (1) when divided by 5.

The notation is "31 = 6 (mod 5)", except instead of "=", you have a similar sign with three horizontals lines that means "is congruent to" instead of "is equal to".
My strategy is to fork people.
love1another
Profile Blog Joined December 2009
United States1844 Posts
August 30 2010 23:51 GMT
#14
Mods are super useful if you want to map something from space of size n to a space of size m.

The easiest way to do such a one-to-one mapping is just to pick i in n and map it to i%m in the space of size m.
"I'm learning more and more that TL isn't the place to go for advice outside of anything you need in college. It's like you guys just make up your own fantasy world shit and post it as if you've done it." - Chill
mieda
Profile Blog Joined February 2010
United States85 Posts
Last Edited: 2010-08-31 00:56:51
August 31 2010 00:43 GMT
#15
In general in mathematics (or more specifically abstract algebra) you can impose additional relations to a given algebraic structure (rings, fields, modules, etc..) by "modding" out by certain sub-spaces (ideals, 0, submodules, subspaces, etc..).

In this case when we "mod n" for an integer n (can actually be n = 0 here) we're imposing the relation the 0 = n on the (ring of) integers and all the other relations that follow by given algebraic structures on them (in this case + and *, so all multiples of n are 0, and this is an equivalence relation).

For another example where this "mod" idea is useful, just consider construction of the complex numbers. We want to enlarge the field of reals to have an element "i" such that i^2 = -1 and it's consistent with all field axioms. One way to do this is direct, but a more slick way is to just consider it as R[x]/(x^2 + 1). Here you're "modding" out the polynomial ring R[x] (R here is the field of reals) by (x^2 + 1), an ideal of R[x] generated by x^2 + 1. The image of element x in R[x]/(x^2 + 1) acts as "i," since we're imposing the condition that x^2 + 1 = 0, or x^2 = -1. Furthermore one can easily check that the natural map R -> R[x]/(x^2 + 1) is injective and is a homomorphism (in fact the kernel is an ideal so it's either 0 or R since R is a field, and clearly it's not all of R, so is 0 ideal) and you can verify that all algebraic structures are well-defined whenever you do this, and that's one value of abstracting concepts.

That's one direction of generalizing "mod" for integers. You can certainly consider it as an operation, but regarding it as an equivalence relation seems to give much more interesting and deep generalizations in mathematics (building idea in abstract algebra!) .

"mod" is an idea in mathematics where you impose certain more structures to get other (hopefully more interesting!) structures.
GrayArea
Profile Blog Joined December 2007
United States872 Posts
August 31 2010 01:26 GMT
#16
What Math is this from? I have taken up to Calculus 2, and I've never seen "mod" before.
Kang Min Fighting!
mieda
Profile Blog Joined February 2010
United States85 Posts
Last Edited: 2010-08-31 01:44:41
August 31 2010 01:33 GMT
#17
On August 31 2010 10:26 GrayArea wrote:
What Math is this from? I have taken up to Calculus 2, and I've never seen "mod" before.


You can first get introduced to "mod" stuff for integers in any intro text in *elementary* number theory (as opposed to modern number theory, which uses just about every branch of mathematics including algebraic geometry, algebraic topology (and topology ofc), combinatorics, etc..). The "mod" stuff for general algebraic structures can be found in any intro to abstract algebra texts (such as Dummit & Foote, Lang, Hungerford, etc..).

For the elementary number theory part, there are many good texts that I used when I was in high school (while preparing for IMO, I made to MOSP and did well enough to be in black team but they wouldn't let me progress further because I did not have U.S. Citizenship at the time, much less a green card T_T) such as Ivan & Zuckermann (in fact this is the only intro elementary number theory book I read cover to cover and is said to be the "canonical" choice!)

Here's one of the books that I read cover to cover in high school which inspired me to major in math in college: http://www.amazon.com/Introduction-Theory-Numbers-Ivan-Niven/dp/0471625469/ref=sr_1_1?ie=UTF8&s=books&qid=1283218586&sr=8-1

It also has many excellent problems, some of which were proposed for IMO longlists (back in the days) I believe.

With that said, this is still elementary part of number theory. That is to say, classical 19th century stuff. Nowadays, thanks to Wiles and Taylor (who happens to be my advisor), modern number theory looks more like a fusion of algebraic geometry (with Grothendieck revolution - schemy stuff, for those of you who know what schemes / sheaf cohomology are ^^) and algebraic number theory mixed with galois representations, modular (and more generally automorphic) forms and representations.

If you'd like a little taste of how number theory has developed into in the last 100 years or so, Mazur has written up a nice article titled "Number as Gadfly"

Here's the link (in my dropbox): http://dl.dropbox.com/u/3799589/MazurGadfly.pdf
EtherealDeath
Profile Blog Joined July 2007
United States8366 Posts
August 31 2010 01:51 GMT
#18
We same a = b mod c if for some integer k, a = ck + b. Thus, 7 = 2 mod 5 since 7 = 5*1 + 2.
You can also interpret it as c divides (a-b) implies a = b mod c. Thus 7 = 2 mod 5 since 5 divides (7-2).

Let Zc = {0, 1, 2, ..., n-1}, that is, the set of residues modulo n. In the above example where c = 5, we would have Z5 = {0,1,2,3,4}. <Zc, +, *> is a commutative ring, with addition and multiplication working as you would assume:

(a mod c) + (b mod c) = (a+b) mod c
(a mod c) * (b mod c) = (a*b) mod c

You might wonder if there is a multiplicative inverse, that is, whether for all a in Zc, there exists a b such that (ab) mod c = (ba) mod c = 1 mod c. Yes, a has a multiplicative inverse modulo c if a and c and relatively prime.

A corollary of this is that if we work in Zp where p is prime, then <Zp, +, *> is a field. That is, it has the "multiplicative identity" and "no zero divisor" properties of an integral domain as well as the "multiplicative inverse" property of a field.

And to answer your question,

So imagine you have any 2 arbitrary numbers x and y and y cant be 0 and you have the following task:
Find out if x is divisable with y, how can you do that using mod?


If x = 0 mod y, then y divides x.
mieda
Profile Blog Joined February 2010
United States85 Posts
August 31 2010 02:37 GMT
#19
Yes, the proofs that Zc (in Ethereal's notation) have well-defined + and * as such are easy to prove, for example ab = cd (mod n) if a = c (mod n) and b = d (mod n) follows directly from ab - cd = a(b - d) + d(a - c).

The fact that if a = b (mod n) then a^k = b^k (mod n) is just repeated applications of the above (and in particular 8^n = 2^n (mod 6), which solves the problem that started this all ^^).

Once basic facts are proved (that the operations are well-defined, fermat's little theorem (and more generally lagrange's theorem applied to the multiplicative structure on Zc), gcd stuff, etc.. the "elementary" number theory things) you're in a position to handle questions that are otherwise more difficult to handle without the language and the basic facts of the theory.

I can list a few well-known (hopefully interesting) exercises here where you can try doing them without resorting to aforementioned facts and perhaps you can appreciate how easy they would be once the basic facts of elementary number theory are down:

1) for p odd prime, and 1/1 + 1/2 + ... + 1/(p-1) = a/b for integers with gcd(a,b) = 1, p divides b (in fact p^2 divides b but this requires a slight more work).

2) for any integer m > 0, the sequence 2, 2^2, 2^(2^2), 2^(2^(2^2)), ... defined by a_1 = 2 and a_n = 2^(a_(n-1)) eventually leaves same remainder upon division by m. I think this is actually an old USAMO problem.

3) (p-1)! + 1 is divisible by p for any odd prime p ^^. This is near trivial once you understand the structure of Z/p (integers mod p) as being a field.

4) many more! ^^

blankspace
Profile Blog Joined June 2010
United States292 Posts
August 31 2010 04:25 GMT
#20
1. don't you mean p divides a? 1 + 1/2 + 1/3 + 1/4 = 25/12 for example.
Pair up the sum into pairs 1/x + 1/(p-x) = p/[x(p-x)]. If we group up stuff we get p(x/y) = a/b or
pxb = ay. p cannot divide y because the lcm of (1,2...p-1) does not contain p so p divides a.
Hello friends
1 2 Next All
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
uThermal 2v2 Circuit S2 Mar
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
GuemChi 3374
Sharp 1330
Stork 334
Leta 298
Tasteless 239
Hm[arnc] 110
soO 95
ggaemo 36
Icarus 10
Sacsri 10
[ Show more ]
ZergMaN 10
Dota 2
NeuroSwarm132
ODPixel11
League of Legends
JimRising 625
Counter-Strike
Stewie2K1072
Super Smash Bros
Mew2King115
Heroes of the Storm
Trikslyr19
Other Games
summit1g10869
C9.Mang0400
ceh9335
RuFF_SC239
Organizations
Counter-Strike
PGL121
StarCraft: Brood War
UltimateBattle 73
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• Berry_CruncH347
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1219
Upcoming Events
Escore
2h 59m
WardiTV Map Contest Tou…
3h 59m
OSC
7h 59m
Big Brain Bouts
8h 59m
MaNa vs goblin
Scarlett vs Spirit
Serral vs herO
Korean StarCraft League
19h 59m
CranKy Ducklings
1d 2h
WardiTV Map Contest Tou…
1d 3h
IPSL
1d 8h
WolFix vs nOmaD
dxtr13 vs Razz
BSL
1d 11h
UltrA vs KwarK
Gosudark vs cavapoo
dxtr13 vs HBO
Doodle vs Razz
CranKy Ducklings
1d 16h
[ Show More ]
Sparkling Tuna Cup
2 days
WardiTV Map Contest Tou…
2 days
Ladder Legends
2 days
BSL
2 days
StRyKeR vs rasowy
Artosis vs Aether
JDConan vs OyAji
Hawk vs izu
IPSL
2 days
JDConan vs TBD
Aegong vs rasowy
Replay Cast
3 days
Wardi Open
3 days
Afreeca Starleague
3 days
Bisu vs Ample
Jaedong vs Flash
Monday Night Weeklies
3 days
RSL Revival
3 days
Afreeca Starleague
4 days
Barracks vs Leta
Royal vs Light
WardiTV Map Contest Tou…
4 days
RSL Revival
5 days
Replay Cast
5 days
The PondCast
6 days
WardiTV Map Contest Tou…
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-04-15
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Escore Tournament S2: W3
StarCraft2 Community Team League 2026 Spring
WardiTV TLMC #16
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W4
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Disclosure: This page contains affiliate marketing links that support TLnet.

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.