0:11

Binary numbers can seem intimidating at first,

Â since they look so different from decimal numbers.

Â But, as far as the basics go the math behind counting,

Â adding, or subtracting binary numbers is exactly the same as with decimal numbers.

Â It's important to call out that there aren't different kinds of numbers.

Â Numbers are universal.

Â There are only different notations for how to reference them.

Â Humans most likely because most of us have ten fingers and ten toes decided

Â on using a system with 10 individual numerals used to represent all numbers.

Â The numerals zero, one,

Â two, three, four, five, six, seven, eight and nine can be combined in

Â ways to represent any whole number in existence.

Â Because there are 10 total numerals in use in a decimal system,

Â another way of referring to this is as base 10.

Â Because of the constraints of how logic gates work inside of a processor,

Â it's way easier for computers to think of things only in terms of zero and one.

Â This is also known as binary or base two.

Â You can represent all whole numbers in binary in the same way you can in decimal,

Â it just looks a little different.

Â When you count in decimal you move through all of the numerals upward until

Â you run out then you add a second column with a higher significance.

Â Let's start counting at zero until we get to nine.

Â Once we get to nine,

Â we basically just start over we add a one to

Â a new column then start over zero in the original column.

Â We repeat this process over and over in order to count all whole numbers.

Â Counting in binary is exactly the same,

Â it's just that you only have two numerals available.

Â You start with zero, which is the same as zero in decimal.

Â Then you increment once.

Â Now you have one, which is the same as one in

Â decimal since we've already run out of numerals to use.

Â It's time to add a new column.

Â So now we have the number one zero which is the same as two in decimal.

Â One one is three,

Â one zero zero is four,

Â one zero one is five,

Â one one zero is six, one one one is seven, etc.

Â It's the exact same thing we do with decimal,

Â just with fewer numerals at our disposal.

Â When working with various computing technologies,

Â you'll often run into the concept of bits or ones and zeros.

Â There's a pretty simple trick to figure out

Â how many decimal numbers can be represented by a certain number of bits.

Â If you have an eight bit number you can just perform the math two to the power of eight,

Â this gives you 256 which lets you know that

Â an eight bit number can represent 256 decimal numbers,

Â or put another way the numbers zero through 255.

Â A 4 bit number would be two to the power of four,

Â or 16 total numbers.

Â A 16 bit number would be two to the power of 16 or 65,536 numbers.

Â In order to tie this back to what you might already know,

Â this trick doesn't only work for binary,

Â it works for any number system,

Â it's just the base changes.

Â You might remember, that we can also refer to binary as base two and decimal as base 10.

Â All you need to do is swap out the base for what's being raised to the number of columns.

Â For example, let's take a base 10 number with two columns of digits.

Â This would translate to 10 to the power of two,

Â 10 and the power two equals 100,

Â which is exactly how many numbers you can represent with two columns

Â of decimal digits or the numbers zero then 99.

Â Similarly,10 to the power three is 1,000 which is exactly how many numbers

Â you can represent with three columns of decimal digits or the numbers 0 through 999.

Â Not only is counting in different bases the same,

Â so as simple arithmetic like addition.

Â In fact, binary addition is even simpler than

Â any other base since you only have four possible scenarios.

Â Zero plus zero equals zero just like in decimal.

Â Zero plus one equals one,

Â and one plus zero equals one should also look familiar.

Â One plus one equals one zero looks a little different,

Â but should still make sense.

Â You carried digit to the next column once you reached 10 in doing decimal edition,

Â you carry a digit to the next column once you reach 2 when doing binary edition.

Â Addition is what's known as an operator and there are

Â many operators that computers use to make calculations.

Â Two of the most important operators are OR and AND.

Â In computer logic, a one represents true and a zero represents false.

Â The way the or operator works is you look at each digit,

Â and if either of them is true,

Â the result is true.

Â The basic equation is X or Y equals Z.

Â Which could be read as,

Â if either X or Y is true then Z is true, otherwise, it's false.

Â Therefore one or zero equals one,

Â but zero or zero equals zero.

Â The operator AND does what it sounds like it does,

Â it returns true if both values are true.

Â Therefore, one and one equals one,

Â but one and zero equals zero,

Â and zero and zero equals zero, and so on.

Â Now, you might be wondering why we've covered all of this.

Â No, it's not to confuse you.

Â It's all really to help explain subnet masks a bit more.

Â A subnet mask is a way for a computer to use and

Â operators to determine if an IP address exists on the same network.

Â This means that the host ID portion is also known,

Â since it will be anything left out.

Â Let's use the binary representation of our favorite IP address

Â 9.100.100.100 and our favorite subnet mask 255.255.255.0.

Â Once you put one on top of the other and perform a binary and operator on each column,

Â you'll notice that the result is the network ID and

Â subnet ID portion of our IP address or 9.100.100.

Â The computer that just performed this operation can now compare the results with

Â its own network ID to determine if the address is on the same network or a different one.

Â I bet you never thought you'd have a favorite IP address or

Â subnet but that's what happens in the wonderful world of basic binary math.

Â