Вы находитесь на странице: 1из 99

How to Add Binary Numbers

Adding binary numbers is very similar to adding decimal numbers, but with a few minor exceptions.
EditSteps1 Align the numbers you wish to add as you would if you were adding decimal numbers.

Start with the two numbers in the far right column.

Add the numbers following the rules of decimal addition (1+0 = 1, 0+0 = 0) unless both numbers are a 1.

Add 1+1 as "10" if present. (it is not "ten" but "one zero"). Write "0" below and carry a "1" to the next column.

Start on the next column to the left.

Repeat the steps above, but add any carry. Remember that 1+1 = 10 and 1+1+1 = 11. Remember to carry the "1".

Edit Don't forget the carry. You can only use the digits 0 and 1. If you find yourself using 2 or any other digit, you did something wrong.

Addition

Adding two binary numbers together is like adding decimal numbers, except 1 + 1 = 10 (in binary, that is), so you have to carry the one to the next column:
0001 + 0100 ---0101 0001 + 0001 ---0010 0011 + 0011 ---0110 0011 + 0101 ---1000

(no carries to get this)

(1 plus 1 is 10, carry the 1 to the next column)

(1 + 1 = 10, so carry; then 1 + 1 + 1 = 11, so carry again)

(carry in every column here)

Subtraction is harder. Don't worry about it.

Larger Numbers
Here are the numbers from 0 to 15, in binary: 0000 = 0 0001 = 1 0010 = 2 0011 = 3 0100 = 4 0101 = 5 0110 = 6 0111 = 7 1000 = 8 1001 = 9 1010 = 10 1011 = 11 1100 = 12 1101 = 13 1110 = 14 1111 = 15 To represent bigger whole numbers (integers), you need more bits -- more places in the binary number:

10000101 = 128 + 0 + 0 + 0 + 0 + 4 + 0 + 1 = 133.

How to Subtract Binary Numbers


Edited by Cased, Teresa, Maluniu, Regalmia and 13 others

0
Article EditDiscuss

Subtracting binary numbers is a bit different than subtracting decimal numbers, but by following the steps below, it can be just as easy.
EditSteps

1. 1
Align the two numbers as you would in decimal subtraction.

2. 2

Append leading zeros if necessary to represent both numbers with the same number of digits. For example, convert 101-11 to 101-011 so that both have three digits.

3. 3
Apply two's complement to the second term:
o

For each digit in the number, change every 1 to 0 and every 0 to 1.

Add 1 to the number.

4. 4
Add the complemented number to the first term. Now the original 101 - 11 has become 101 + 101 = 1010.

5. 5
The sum in the previous step should have one more digit than you started with. Remove the most significant digit from the sum to get 101 - 11 = 010. If you don't have an extra digit, you tried to subtract a larger number from a smaller one.

EditVideo

EditTips n n This "2s complement" method works by the identity: a - b = a + (2 - b) - 2 . n When n is the number of digits in b, 2 - b is one more than the result of negating each digit. EditRelated wikiHows How to Add Binary Numbers How to Convert from Binary to Decimal How to Convert from Decimal to Binary How to Read Binary
Multiplication & Division

547

184

39

4 Share 34.8K

Binary multiplication

is actually much simpler than decimal multiplication. In the case of decimal multiplication, we need to remember 3 x 9 = 27, 7 x 8 = 56, and so on. In binary multiplication, we only need to remember the following, 0x0=0 0x1=0 1x0=0 1x1=1

Note that since binary operates in base 2, the multiplication rules we need to remember are those that involve 0 and 1 only. As an example of binary multiplication we have 101 times 11,

101 x11 First we multiply 101 by 1, which produces 101. Then we put a 0 as a placeholder as we would in decimal multiplication, and multiply 101 by 1, which produces 101.

101 x11 101 1010 <-- the 0 here is the placeholder

The next step, as with decimal multiplication, is to add. The results from our previous step indicates that we must add 101 and 1010, the sum of which is 1111.

101 x11 101 1010 1111

Binary division

is almost as easy, and involves our knowledge of binary multiplication. Take for example the division of 1011 into 11. 11 R=10 11 )1011 -11 101 -11 10 <-- remainder, R

To check our answer, we first multiply our divisor 11 by our quotient 11. Then we add its' product to the remainder 10, and compare it to our dividend of 1011.

11 x 11 11 11 1001 <-- product of 11 and 11

1001 + 10 1011 <-- sum of product and remainder

The sum is equal to our initial dividend, therefore our solution is correct.

To practice binary addition and subtraction, visit the Practice Exercises page.

- See more at: http://www.binarymath.info/multiplication-division.php#sthash.mkrlPyIz.dpuf

How to Convert from Binary to Decimal


Edited by Sean Hickey, Tom Viren, Sondra C, Rabinux and 77 others

7
Article

EditDiscuss

The binary (base two) numeral system has two possible values, often represented as 0 or 1, for each place-value. In contrast, the decimal (base ten) numeral system has ten possible values (0,1,2,3,4,5,6,7,8, or 9) for each place-value. To avoid confusion while using different numeral systems, the base of each individual number may be specified by writing it as a subscript of the number. For example, the binary number 10011100 may be specified as "base two" by writing it as 100111002. The decimal number 156 may be written as 15610 and read as "one hundred fifty-six, base ten". Since the binary system is the internal language of electronic computers, serious computer programmers should understand how to convert from binary to decimal. Converting in the opposite direction, from decimal to binary, is often more difficult to learn first. Note: This is ONLY for counting and does not talk about ASCII translations.
EditSteps
Converter

Binary to Decimal Converter

Positional notation method

1. 1
For this example, let's convert the binary number 100110112 to decimal. List the powers of two from right to left. Start at 20, evaluating it as "1". Increment the exponent by one for each power. Stop when the amount of elements in the list is equal to the amount of digits in the binary number. The example number, 10011011, has eight digits, so the list, to eight elements, would look like this: 128, 64, 32, 16, 8, 4, 2, 1

2. 2
Write first the binary number below the list.

3. 3
Draw lines, starting from the right, connecting each consecutive digit of the binary number to the power of two that is next in the list above it. Begin by drawing a line from the first digit of the binary number to the first power of two in the list above it. Then, draw a line from the second digit of the binary number to the second power of two in the list. Continue connecting each digit with its corresponding power of two.

4. 4
Move through each digit of the binary number. If the digit is a 1, write its corresponding power of two below the line, under the digit. If the digit is a 0, write a 0 below the line, under the digit.

5. 5
Add the numbers written below the line. The sum should be 155. This is the decimal equivalent of the binary number 10011011. Or, written with base subscripts:

6. 6
Repetition of this method will result in memorization of the powers of two, which will allow you to skip step 1.

Doubling method

1. 1
This method does not use powers. As such, it is simpler for converting large numbers in your head because you only need to keep track of a subtotal.

2. 2
Start with the left-most digit of the given binary number. For each digit as you move to the right, double your previous total and add the current digit. For example, to convert 10110012 to decimal, we take the following steps:

3. 3
1011001 0 * 2 + 1 = 1

4. 4
1011001 1 * 2 + 0 = 2

5. 5
1011001 2 * 2 + 1 = 5

6. 6
1011001 5 * 2 + 1 = 11

7. 7
1011001 11 * 2 + 0 = 22

8. 8
1011001 22 * 2 + 0 = 44

9. 9
1011001 44 * 2 + 1 = 8910

10.

10

Like the positional notation method, this method can be modified to convert fromany base to decimal. Doubling is used because the given number is of base 2. If the given number is of a different base, replace the 2 in the method with the base of the given number. For example, if the given number is in base 37, you would replace the *2 with *37. The final result will always be in decimal (base 10).

:)
EditTips
Practice. Try converting the binary numbers 110100012, 110012, and 111100012. Respectively, their decimal equivalents are 20910, 2510, and 24110. The calculator that comes installed with Microsoft Windows can do this conversion for you, but as a programmer, you're better off with a good understanding of how the conversion works. The calculator's conversion options can be made visible by opening its "View" menu and selecting "Scientific" (or "Programmer"). On Linux, you can use galculator.

How to Convert from Decimal to Binary


Edited by Sean Hickey, Tom Viren, Sondra C, Lucas Halbert and 73 others

Article

EditDiscuss

The decimal (base ten) numeral system has ten possible values (0,1,2,3,4,5,6,7,8, or 9) for each place-value. In contrast, the binary (base two) numeral system has two possible values, often represented as 0 or 1, for each place-value. To avoid confusion while using different numeral systems, the base of each individual number may be specified by writing it as a subscript of the number. For example, the decimal number 156 may be written as 15610 and read as "one hundred fifty-six, base ten". The binary number 10011100 may be specified as "base two" by writing it as 100111002. Since the binary system is the internal language of electronic computers, serious computer programmers should understand how to convert from decimal to binary. Here's how to do it.
EditSteps
Converter

Decimal to Binary Converter

Choosing a method of conversion


Short division by two with remainder (easier for beginners) Comparison with descending powers of two and subtraction

Method One: Short Division by Two with Remainder

This method is much easier to understand when visualized on paper. It relies only on division by two.

1. 1
Set up the problem. For this example, let's convert the decimal number 15610 to binary.

o o

Write the decimal number as the dividend inside an upside-down "long division" symbol. Write the base of the destination system (in our case, "2" for binary) as the divisor outside the curve of the division symbol.

2. 2
Write the integer answer (quotient) under the long division symbol, and write the remainder (0 or 1) to the right of the dividend.

Basically, if the dividend is even, the binary remainder will be 0; if the dividend is odd, the binary remainder will be 1.

3. 3
Continue downwards, dividing each new quotient by two and writing the remainders to the right of each dividend. Stop when the quotient is 0.

4. 4
Starting with the bottom remainder, read the sequence of remainders upwards to the top. For this example, you should have 10011100. This is the binary equivalent of the decimal number 156. Or, written with base subscripts: 15610 = 100111002

This method can be modified to convert from decimal to any base. The divisor is 2 because the desired destination is base 2. If the desired destination is a different base, replace the 2 in the method with the desired base. For example, if the desired destination is base 9, replace the 2 with 9. The final result will then be in the desired base.
Method Two: Descending Powers of Two and Subtraction

1. 1
List the powers of two in a "base 2 table" from right to left. Start at 20, evaluating it as "1". Increment the exponent by one for each power. The list, to ten elements, would look like this: 512, 256, 128, 64, 32, 16, 8, 4, 2, 1

2. 2
Figure out the greatest power that will fit into the number you want to convert to binary. For this example, let's convert the decimal number 15610 to binary. What is the greatest power of two that will fit into 156? Since 128 fits, write a 1 for the leftmost binary digit, and subtract 128 from your decimal number, 156. You now have 28.

3. 3
Move to the next lower power of two. Can 64 fit into 28? No, so write a 0 for the next binary digit to the right.

4. 4
Can 32 fit into 28? No, so write a 0.

5. 5
Can 16 fit into 28? Yes, so write a 1, and subtract 16 from 28. You now have 12.

6. 6
Can 8 fit into 12? Yes, so write a 1, and subtract 8 from 12. You now have 4.

7. 7
Can 4 (power of two) fit into 4 (working decimal)? Yes, so write a 1, and subtract 4 from 4. You have 0.

8. 8
Can 2 fit into 0? No, so write a 0.

9. 9
Can 1 fit into 0? No, so write a 0.

10.

10

Put together the binary answer. Since there are no more powers of two in the list, you are done. You should have 10011100. This is the binary equivalent of the decimal number 156. Or, written with base subscripts: 15610 = 100111002.

Repetition of this method will result in memorization of the powers of two, which will allow you to skip Step 1.

EditVideo

EditTips The calculator that comes installed with your operating system can do this conversion for you, but as a programmer, you're better off with a good understanding of how the conversion works. The calculator's conversion options can be made visible by opening its "View" menu and selecting "Programmer"

Practice. Try converting the decimal numbers 17810, 6310, and 810. The binary equivalents are 101100102, 001111112, and 000010002. Try converting 20910, 2510, and 24110 to, respectively, 110100012, 000110012, and 111100012. Converting in the opposite direction, from binary to decimal, is often easier to learn first.

How to Convert from Decimal to Hexadecimal


Edited by Jane_B, Maluniu, Katie, Zeal and 27 others

Article

EditDiscuss

The decimal (base ten) numeral system has ten possible values (0,1,2,3,4,5,6,7,8, or 9) for each place-value. In contrast, the hexadecimal (base sixteen) numeral system has sixteen possible values, using the letters A, B, C, D, E, and F for the six place-values after 9. To avoid confusion while using different numeral systems, the base of each individual number may be specified by writing it as a subscript of the number. For example, the decimal number 512 may be written as 51210 and read as "five hundred and twelve, base ten". The hexadecimal number 512 may be specified as "base sixteen" by writing it as 51216 (which is 1298 when converted to decimal).
EditConverter

Decimal to Hexadecimal Converter

EditSteps
By Hand

1. 1
Divide the decimal number by 16. Treat the division as an integer division, that is, do not calculate the quotient in decimals - stop once a remainder is obtained.

2. 2
Write down the remainder in hexadecimal notation. For example, if the remainder is 11, write it down as B16 (the subscript 16 indicates a hexadecimal character). Refer to the wikiHow Understand Hexadecimal to learn the basic 16 characters of the hexadecimal notation.

3. 3
Divide the quotient obtained by 16 (treat the division as an integer division) and again write the remainder obtained in hexadecimal notation.

4. 4
Repeat the above step until a quotient less than 16 is obtained. During the process every time write the remainder obtained in hexadecimal notation. Please note that we also need to write the last quotient (the one which is less than 16) of the process in hexadecimal notation.

5. 5
Arrange the list of remainders and the last quotient from Left to Right in order they were obtained, keeping the last quotient in the last place. The desired hexadecimal value of the given decimal number is simply this sequence readRight to Left. For example if the sequence reads 2F34, the desired hexadecimal value is 43F2.

With Windows Calculator

1. 1
On your Windows computer press start, choose 'Accessories and then Calculator'. A calculator will now appear on your screen.

2. 2
On this calculator window select 'View' and check 'Programmer'.

3. 3
After ensuring the 'Dec' option is chosen (2nd radio button in towards the left of the window), enter the number you wish to convert

4. 4
Now select the 'Hex' option. The result is displayed automatically.

EditVideo

EditExamples
256

1. 2. 3. 4.

Let's convert 256 to hexadecimal. Divide it by 16: 256/16 = 16. Since it has no remainder, put "0" as a remainder. Divide 16 by 16, which is 1. No remainder, so again put "0" as a remainder. Lastly, since we know that 1/16 is less than one, just put 1 as the remainder. Our remainder list is 001, so we switch it around and get 100. 100 is hexadecimal for 256!
2500

1. This gets more tricky. Divide 2500 by 16, we get 156.25. Multiply our remainder, (.25), by 16. This gives us 4. Add 4 to the list of remainders. 2. Divide 156 by 16, which gives us 9.75. Multiply the remainder by 16, we get 12. Add 12 to the list of remainders. (Remember, in hexadecimal, 12 is C, so put C instead.) Our remainder list should be: 4C.

3. Since we know 9/16 is less than one, add 9 to the list of remainders without bothering to divide it. The remainder list is 4C9. Switch it around, and we get 9C4. 9C4 is hexadecimal for 2500.
EditConversion

Table
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F

How to Decode Binary Numbers


Edited by Leila, Jay

0
Article EditDiscuss

This article will show you how to decode binary numbers into alphabetical or numerical characters.
EditSteps

1. 1
Remember that in binary 1 is "on: and 0 is "off."

2. 2
Choose the binary number that you want to decode.

3. 3
Give each number a value, starting from the extreme right.

o o

For example, using the number 1001001, 1=2, +0=4, +0=8, +1=16, +0=32, +0=64, +1=128. The number becomes: 128+64+32+16+8+4+2.

4. 4
Cut off all values that are of 0 and add values of 1.

0 values = 4,8,32,64 --> 1 values = 16+128=144

5. 5
Change the answer from its numerical form of the character to its alphabetical form by using an alphabet-number-punctuation chart. [1]

6. 6
Divide each of your numbers into groups of 8, and then convert them to numerical form.

For example, 111111110000000011111111=11111111+00000000+11111111

How to Add a Consecutive Series of Numbers in Your Head


Edited by Vivek Kumar Rohra, Ben Rubenstein, KnowItSome, Flickety and 5 others

0
Article EditDiscuss

The ability to quickly add a long string of consecutive numbers in your head is a real party show-stopper! Imagine being at a party, and being able to quickly and accurately add all the numbers from 1 to 50, or 1 to 100, for example. Not only does this make an impressive party trick, but it can really come in handy in daily life, as it sharpens one's thinking skills and abilities.

EditSteps

1. 1
Imagine the numbers. Let's suppose that you want to add all the numbers from 1 to 100 in your head. Imagine that on a table in front of you you have arranged stacks of pennies, in a long neat row left to right, to equal each of these numbers. For example, the first stack of pennies starting on the left side of the table is just one penny by itself. Beside it, to its right is a stack of 2 pennies. To the immediate right of the 2 penny stack is a stack of 3 pennies, and so on, clear up to a stack that is 100 pennies tall.

2. 2
Count the stacks: You have 100, right?

3. 3
Imagine what would happen' if you took the penny from stack #1, and put it on the top of stack #100? You would have a stack that totaled 101 pennies.

4. 4
Imagine if you then took the 2 pennies from stack #2 and put them on top of stack #99 (which has 99 pennies in it)? You would now have another stack of pennies that totaled 101 pennies!

5. 5

Continue with this pattern by putting the 3 pennies from stack #3 on top of stack #98, you will see that this also gives you another stack totaling 101 pennies.

Continue with this pattern by putting the 3 pennies from stack #3 on top of stack #98, you will see that this also gives you another stack totaling 101 pennies.

6. 6
Apply this pattern all the way through, and it will hold true for each combination of the stack from the right added to the next stack form the left. You will always end up with a new stack that totals 101 pennies.

7. 7
Combine the stacks in this manner, in your imagination, until you end up with only 50 stacks, and each stack now contains 101 pennies.

8. 8
Quickly add in your head how many pennies you have by counting the stacks of 101 pennies: 101 times 50. We know that if you multiply any number by 100, you just add 2 zeros, so 50 times 100 would be 5000.

9. 9
Since we are multiplying by 101, not 100, you just need to add another 50 to the 5000, and you come up with the correct total of 5050.

10.

10

Use this mental formula to add any series of sequential numbers. Admittedly, it could get rather hard if the series of numbers aren't in well-rounded chunks of numbers, or if they get too large, but this skill can stand you in good stead in daily life, as it can help your estimating skills, and help keep your mind sharp.
EditTips

Here's another simple way to sum up a series of number. Use the mathmatical formula sum(n) = ( n * (n+1) ) / 2 - Check - This will work only if you want to add numbers starting from 1 and upto n. If the sequence doesn't start at 1, say it's from n to m, then just do the above formulat twice, once for m and once for whatever number is before n. Subtract the second answer from the first. This trick or technique can be used with any series of numbers that are evenly spaced apart. Realize that a shorter series of numbers is easier to do, but less impressive. If you find it is just too hard to do the math in your head, you can always wow the party crowd by telling them you can add up all the consecutive numbers in less than one minute (instead of in your head), and have a scratch pad and a pencil handy to do the math. Practice this skill at home before you try it in front of friends or a group.

EditWarnings Try not to embarrass yourself in front of others by forgetting how to do the trick right in the middle of it! EditRelated wikiHows How to Calculate Pi by Throwing Frozen Hot Dogs How to Add Large Numbers How to Divide Fractions by a Whole Number How to Learn Math How to Calculate the Area of a Circle How to Recover from a Bungled Magic Trick

How to Learn Math


Edited by Ben Rubenstein, Lily A, Lesley V., Ray McIntyre and 42 others

Article

EditDiscuss

Anyone can learn math whether they're in higher math at school or just looking to brush up on the basics. After discussing ways to be a good math student, this article will teach you the basic progression of math courses and will give you the basic elements that you'll need to learn in each course. Then, the article will go

through the basics of learning arithmetic, which will help both kids in elementary school and anyone else who needs to brush up on the fundamentals.
EditSteps
Part 1: Keys to Being a Good Math Student

1. 1
Show up for class. When you miss class, you have to learn the concepts either from a classmate or from your textbook. You'll never get as good of an overview from your friends or from the text as you will from your teacher.
o

Come to class on time. In fact, come a little early and open your notebook to the right place, open your textbook and take out your calculator so that you're ready to start when your teacher is ready to start. Only skip class if you are sick. When you do miss class, talk to a classmate to find out what the teacher talked about and what homework was assigned.

2. 2
Work along with your teacher. If your teacher works problems at the front of your class, then work along with the teacher in your notebook.
o

o o

Make sure that your notes are clear and easy to read. Don't just write down the problems. Also write down anything that the teacher says that increases your understanding of the concepts. Work any sample problems that your teacher posts for you to do. When the teacher walks around the classroom as you work, answer questions. Participate while the teacher is working a problem. Don't wait for your teacher to call on you. Volunteer to answer when you know the answer, and raise your hand to ask questions when you're unsure of what's being taught.

3. 3
Do your homework the same day as it's assigned. When you do the homework the same day, the concepts are fresh on your mind. Sometimes, finishing your homework the same day isn't possible. Just make sure that your homework is complete before you go to class.

4. 4

Make an effort outside of class if you need help. Go to your teacher during his or her free period or during office hours.
o o

If you have a Math Center at your school, then find out the hours that it's open and go get some help. Join a study group. Good study groups usually contain 4 or 5 people at a good mix of ability levels. If you're a "C" student in math, then join a group that has 2 or 3 "A" or "B" students so that you can raise your level. Avoid joining a group full of students whose grades are lower than yours.[1]
Part 2: Learning Math in School

1. 1
Start with arithmetic. In most schools, students work on arithmetic during the elementary grades. Arithmetic includes the fundamentals of addition, subtraction, multiplication and division.
o

Work on drills. Doing a lot of arithmetic problems again and again is the best way to get the fundamentals down pat. Look for software that will give you lots of different math problems to work on. Also, look for timed drills to increase your speed. You can also find arithmetic drills online, and you can download arithmetic apps onto your mobile device.

2. 2
Progress to pre-algebra. This course will provide the building blocks that you'll need to solve algebra problems later on.
o

o o

Learn about fractions and decimals. You'll learn to add, subtract, multiply and divide both fractions and decimals. Regarding fractions, you'll learn how to reduce fractions and interpret mixed numbers. Regarding decimals, you'll understand place value, and you'll be able to use decimals in word problems. Study ratios, proportions and percentages. These concepts will help you to learn about making comparisons. Introduce yourself to basic geometry. You'll learn all of the shapes as well as 3D concepts. You'll also learn concepts like area, perimeter, volume and surface area, as well as information about parallel and perpendicular lines and angles. Understand some basic statistics. In pre-algebra, your introduction to statistics mostly includes visuals like graphs, scatter plots, stem-and-leaf plots and histograms.

Learn algebra basics. These will include concepts like solving simple equations containing variables, learning about properties like the distributive property, graphing simple equations and solving inequalities.

3. 3
Advance to Algebra I. In your first year of algebra, you will learn about the basic symbols involved in algebra. You'll also learn to:
o o

Solve equations and inequalities that contain variables. You'll learn how to solve these problems on paper as well as how to solve them by graphing. Tackle word problems. You'll be surprised how many everyday problems that you'll face in your future involve the ability to solve algebraic word problems. For example, you'll use algebra to figure out the interest rate that you earn on your bank account or on your investments. You can also use algebra to figure out how long you'll have to travel based on the speed of your car. Work with exponents. When you start solving equations with polynomials (expressions containing both numbers and variables), you'll have to understand how to use exponents. This may also include working with scientific notation. Once you have exponents down, you can learn to add, subtract, multiply and divide polynomial expressions. Solve squares and square roots. When you've mastered this topic, you'll have perfect squares of many numbers memorized. You'll also be able to work with equations containing square roots. Understand functions and graphs. In algebra, you'll really get into graphic equations. You'll learn how to calculate the slope of a line, how to put equations into point-slope form, and how to calculate the x- and y-intercepts of a line using slope-intercept form. Figure out systems of equations. Sometimes, you're given 2 separate equations with both x and y variables, and you have to solve for x or y for both equations. Fortunately, you'll learn many tricks for solving these equation including graphing, substitution and addition.[2]

4. 4
Get into geometry. In geometry, you'll learn about the properties of lines, segments, angles and shapes.[3]
o

You'll memorize a number of theorems and corollaries that will help you to understand the rules of geometry.

You'll learn how to calculate the area of a circle, how to use the Pythagorean theorem and how to figure out relationships between angles and sides of special triangles. You'll see a lot of geometry on future standardized tests like the SAT, the ACT and the GRE.

5. 5
Take on Algebra II. Algebra II builds on the concepts that you learned in Algebra I but adds more complex topics like quadratic equations and matrices.

6. 6
Tackle trigonometry. You know the words of trig: sine, cosine, tangent, etc. Trigonometry will teach you many practical ways to calculate angles and lengths of lines, and these skills will be invaluable for people who go into construction, architecture, engineering or surveying.

7. 7
Count on some calculus. Calculus may sound intimidating, but it's an amazing tool chest for understanding both the behavior of numbers and the world around you.
o o

o o

Calculus will teach you about functions and about limits. You'll see the behavior or a number of useful functions including e^x and logarithmic functions. You'll also learn how to calculate and work with derivatives. A first derivative gives you information based on the slope of a tangent line to an equation. For instance, a derivative tells you the rate at which something is changing in a nonlinear situation. A second derivative will tell you whether a function is increasing or decreasing along a certain interval so that you can determine the concavity of a function. Integrals will teach you how to calculate the area beneath a curve as well as volume. High school calculus usually ends with sequences and series. Although students won't see many applications for series, they are important to people who go on to study differential equations.[4]
Part 3: Math Fundamentals--Ace Some Addition

1. 1

Start with "+1" facts. Adding 1 to a number takes you to the next highest number on the number line. For example, 2 + 1 = 3.

2. 2
Understand zeroes. Any number added to zero equals the same number because "zero" is the same as "nothing."

3. 3

Learn doubles. Doubles are problems that involve adding two of the same number. For example, 3 + 3 = 6 is an example of an equation involving doubles.

4. 4
Use mapping to learn about other addition solutions. In the example below, you learn through mapping what happens when you add 3 to 5, 2 and 1. Try the "add 2" problems on your own.

5. 5
Go beyond 10. Learn to add 3 numbers together to get a number larger than 10.

6. 6
Add larger numbers. Learn about regrouping 1s into the 10s place, 10s into the 100s place, etc.
o

Add the numbers in the right column first. 8 + 4 = 12, which means you have 1 10 and 2 1s. Write down the 2 under the 1s column.

Write the 1 over the 10s column.

Add the 10s column together.

Part 4: Math Fundamentals--Strategies for Subtraction

1. 1

Start with "backwards 1." Subtracting 1 from a number takes you backwards 1 number. For example, 4 - 1 = 3.

2. 2
Learn doubles subtraction. For instance, you add the doubles 5 + 5 to get 10. Just write the equation backward to get 10 - 5 = 5.

o o

If 5 + 5 = 10, then 10 - 5 = 5. If 2 + 2 = 4, then 4 - 2 = 2.

3. 3
Memorize fact families. For example:
o o o o

3+1=4 1+3=4 4-1=3 4-3=1

4. 4
Find the missing numbers. For example, ___ + 1 = 6 (the answer is 5).

5. 5

Memorize subtraction facts up to 20.

6. 6
Practice subtracting 1-digit numbers from 2-digit numbers without borrowing. Subtract the numbers in the 1s column and bring down the number in the 10s column.

7. 7
Practice place value to prepare for subtracting with borrowing.
o o o

32 = 3 10s and 2 1s. 64 = 6 10s and 4 1s. 96 = __ 10s and __ 1s.

8. 8
Subtract with borrowing.

You want to subtract 42 - 37. You start by trying to subtract 2 - 7 in the 1s column. However, that doesn't work!

Borrow 10 from the 10s column and put it into the 1s column. Instead of 4 10s, you now have 3 10s. Instead of 2 1s, you now have 12 1s.

Subtract your 1s column first: 12 - 7 = 5. Then, check the 10s column. Since 3 - 3 = 0, you don't have to write 0. Your answer is 5.[5]

Part 5: Math Fundamentals--Master Multiplication

1. 1
Start with 1s and 0s. Any number times 1 is equal to itself. Any number times zero equals zero.

2. 2
Memorize the multiplication table.

3. 3
Practice single-digit multiplication problems

4. 4
Multiply 2-digit numbers times 1-digit numbers.
o o

Multiply the bottom right number by the top right number. Multiply the bottom right number by the top left number.

5. 5

Multiply 2 2-digit numbers.


o o o o

Multiply the bottom right number by the top right and then the top left numbers. Shift the second row one digit to the left. Multiply the bottom left number by the top right and then the top left numbers. Add the columns together.

6. 6
Multiply and regroup the columns.
o

You want to multiply 34 x 6. You start by multiplying the 1s column (4 x 6), but you can't have 24 1s in the 1s column.

Keep 4 1s in the 1s column. Move the 2 10s over to the 10s column.

Multiply 6 x 3, which equals 18. Add the 2 that you carried over, which will equal 20.[6]

Part 6: Math Fundamentals--Discover Division

1. 1
Think of division as the opposite of multiplication. If 4 x 4 = 16, then 16 / 4 = 4.

2. 2
Write out your division problem.

Divide the number to the left of the division symbol, or the divisor, into the first number under the division symbol. Since 6 / 2 = 3, you'll write 3 on top of the division symbol.

Multiply the number on top of the division symbol by the divisor. Bring the product down under the first number under the division symbol. Since 3 x 2 = 6, then you'll bring a 6 down.

Subtract the 2 numbers that you've written. 6 - 6 = 0. You can leave the 0 blank also, since you don't usually start a new number with 0.

Bring the second number that is under the division symbol down.

Divide the number that you brought down by the divisor. In this case, 8 / 2 = 4. Write 4 on top of the division symbol.

Multiply the top right number by the divisor and bring the number down. 4 x 2 = 8.

Subtract the numbers. The final subtraction equals zero, which means that you have finished the problem. 68 / 2 = 34.[7]

3. 3
Account for remainders. Some divisors won't divide evenly into other numbers. When you've finished your final subtraction, and you have no more numbers to bring down, then the final number is your remainder.[8]

EditTips

Mathematics is not a passive activity. You cannot learn mathematics by reading a textbook. Use online tools or worksheets from your teacher to practice problems until you understand the concepts.

EditWarnings Don't become dependent on a calculator. Learn to solve the problems by hand so that you understand the step-by-step process. EditThings Pencil Paper

You'll Need wikiHows

EditRelated

How to Add or Subtract Fractions Using Vedic Math


Edited by Somebody, Dominique, Choicefresh, Trigtchr and 9 others

0
Article EditDiscuss

To add fractions the normal way, you would have to find a common denominator and add the now changed numerators, but there is another way. Vedic math can help you solve what would be hard a problem, easily. There are sixteen different "sayings" in Vedic math, but here is just one: "Vertically and Crosswide."
EditSteps

1. 1
Write down your problem. Write your problem down so that the numerator is directly above the denominator. This will make things easier.

2. 2
Cross Multiply. Multiply your first number's numerator by your second number's denominator before doing the opposite, multiplying your first number's denominator by your second numbers numerator.

3. 3
Add or Subtract. Depending on what problem you are trying to solve, add or subtract the answers you got in the previous step. This will give you a numerator.

4. 4
Multiply. For the denominator, multiply your denominators.

5. 5
Finished!

EditTips Make sure you put your answer into lowest terms. For example, the problem of 5/6 + 3/8 will turn into (40+18)/48, which results in 58/48. But this answer can be simplified to 29/24. (It could also be rewritten as the mixed number 1 5/24.) EditWarnings Some teachers will want you to find the answer a different way, and will ask you to show your work. This method does not actually explain how adding or subtracting fractions really works. It is important to understand how something really works before using a shortcut, or gimick, to do so. There may be some problems later on in more advanced math if you do not actually understand 'why' fractions work they way they do. Here's how to do it. EditRelated wikiHows How to Teach a Child to Carry Numbers How to Multiply Using Vedic Math How to Subtract Large Numbers Ending With Zero Using Vedic Math How to Add 5 Consecutive Numbers Quickly How to Solve Math Problems

How to Work With Percentages How to Compare Fractions

Adding binary numbers


We add binary numbers just like we add decimal numbers, using the technique you learned in grade school. But now we add bits in binary, so 1 + 1 = 10 (the binary representation of 2), and 1 + 1 + 1 = 11 (the binary representation of 3). Let's look at an example. We want to add 1011 and 111. (Verify that these are decimal 11 and 7.) We begin at the 1's place, and note that 1 + 1 = 10. We place the last bit of 10 in the 1's place of the solution and carry the rest (a 1) to the 2's place.
1 1011 + 111 -----0

Now we look at the 2's place. We see 1 + 1 + 1 = 11. So we write a 1 in the 2's place of the answer and carry the 1.
1 1011 + 111 -----10

We examine the 4's place. 1 + 0 + 1 = 10. Write 0 in the 4's place and carry the 1.
1 1011 + 111 -----010

The 8's place is next. 1 + 1 = 10. 0 goes in the 8's place, and we carry the 1.
1 1011 + 111 -----0010

Finally, in the 16's place we have only a 1 to put into the answer.
1011 + 111 -----10010

You can see that this is the binary representation of 18, the sum of 11 and 7.

Multiplying binary numbers

Again, we can multiply binary numbers just as we learned to multiply decimal numbers in grade school. Indeed, the multiplication table for just zeroes and ones is much easier! Say we want to multiply decimal 11 and 5 in binary. Their binary representation is 1011 and 101. We write them both, and begin with the 1's bit of the multiplier (5). Since this is a 1, we write 1 times 1011 below the line.
1011 * 101 -------1011

Now the 2's bit of the multiplier is 0. So we write 0 times 1011 below that, shifted left one place.
1011 * 101 -------1011 0000

Finally, the 4's bit is a 1. We write 1 times 1011 below that, shifted left one place.
1011 * 101 -------1011 0000 1011

We add these three lines together to get the answer.


1011 * 101 -------1011 0000 + 1011 -------110111

The answer, converted to decimal, is 55, indeed the product of 11 and 5.


Multiplying binary numbers Binary multiplication can be achieved in a similar fashion to multiplying decimal values. Using the long multiplication method, ie, by multiplying each digit in turn, and then adding the values together. For example, lets do the following multiplication: 1011 x 111 (decimal 1110 x 710)

which gives us 1001101, now we can convert this value into decimal, which gives 7710 So the full calculation in decimal is 1110 x 710 = 7710 (correct !!) note: Notice the pattern in the partial products, as you can see multiplying a binary value by two can be achieved by shifting the bits to the left and adding zeroes to the right. Dividing binary numbers Like multiplication, dividing binary values is the same as long division in decimal. For example, lets do the following division: 1001 11 (decimal 910 310)

which gives us 0011, now we can convert this value into decimal, which gives 310 So the full calculation in decimal is 910 310 = 310 (correct !!) note: Dividing a binary value by two can also be achieved by shifting the bits to the right and adding zeroes to the left.

Number Bases: Octal (Base 8) and Hexadecimal (Base 16) (page 3 of 3)


Sections: Introduction & binary numbers, Base 4 & base 7, Octal & hexadecimal

Octal
An older computer base system is "octal", or base eight. The digits in octal math are and 7. The value "eight" is written as "1 eight and

0, 1, 2, 3, 4, 5, 6,

0 ones", or 108.

Convert

35710to the corresponding base-eight number. 8 at each step:

I will do the usual repeated division, this time dividing by

Then the corresponding octal number is Now YOU try it! Convert

5458.

5458 to the corresponding decimal number.

I will follow the usual procedure, counting off the digits from the RIGHT, starting at zero:

5 4 5 numbering: 2 1 0
digits: Then I'll do the addition and multiplication:

582 + 481 + 580 = 564 + 48 + 51 = 320 + 32 + 5 = 357


Then the corresponding decimal number is Now YOU try it!

35710.

Hexadecimal
ADVERTISEMENT

If you work with computer programming or computer engineering (or computer graphics, about which more later), you will encounter basesixteen, or hexadecimal, math. As mentioned before, decimal math does not have one single solitary digit that represents the value of "ten". Instead, we use two digits, a 1and a 0: "10". But in hexadecimal math, the columns stand for multiples of sixteen! That is, the first column stands for how many units you have, the second column stands for how many sixteens, the third column stands for how many two hundred fiftysixes (sixteen-times-sixteens), and so forth. In base ten, we had digits eight, we had digits digits

0 through 9. In base 0 through 7. In base 4, we had digits 0 through 3. In any base system, you will have

0 through one-less-than-your-base. This means that, in hexadecimal, we need to have "digits" 0 through 15. To do this, we would need single solitary digits that stand for the values of "ten",
"eleven", "twelve", "thirteen", "fourteen", and "fifteen". But we don't. So, instead, we use letters. That is, counting in hexadecimal, the sixteen "numerals" are:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
In other words, A is "ten" in "regular" numbers, B is "eleven", C is "twelve", D is "thirteen", E is "fourteen", and "F" is fifteen. It is this use of letters for digits that makes hexadecimal numbers look so odd at first. But the conversions work in the usual manner. Convert

35710 to the corresponding hexadecimal number.

Here, I will divide repeatedly by 16, keeping track of the remainders as I go. (You might want to use some scratch paper for this.)

Reading off the digits, starting from the top and wrapping around the right-hand side, I see that35710 = 16516. Convert

16516 to the corresponding decimal number.

List the digits, and count them off from the RIGHT, starting with zero:

1 6 5 numbering: 2 1 0
digits:

Remember that each digit in the hexadecimal number represents how many copies you need of that power of sixteen, and convert the number to decimal:

1162 + 6161 + 5160 = 1256 + 616 + 51 = 256 + 96 + 5 = 357


Then

16516 = 35710. 6393310 to the corresponding hexadecimal number. 16, keeping track of my remainders:

Convert

I will divide repeatedly by

From the long division, I can see that the hexadecimal number will have a "fifteen" in the sixteencubeds column, a "nine" in the sixteen-squareds column, an "eleven" in the sixteens column, and a "thirteen" in the ones column. But I cannot write the hexadecimal number as " 1591113", because this would be confusing and imprecise. So I will use the letters for the "digits" that are otherwise too large, letting "F" stand in for "fifteen", "B" stand in for "eleven", and "D" stand in for "thirteen". Then
Copyright Elizabeth Stapel 1999-2011 All Rights Reserved

6393310 = F9BD16.

Now YOU try it! Convert

F9BD to decimal notation.

I will list out the digits, and count them off from the RIGHT, starting at zero:

F 9 B D numbering: 3 2 1 0
digits: Actually, it will probably be helpful to redo this, converting the alphabetic hexadecimal "digits" to their corresponding "regular" decimal values:

15 numbering: 3
digits:

9 11 13 2 1 0

Now I'll do the multiplication and addition:

15163 + 9162 + 11161 + 13160 = 154096 + 9256 + 1116 + 131 = 61440 + 2304 + 176 + 13 = 63933
As expected, Now YOU try it!

F9BD = 6393310.

If you would like to try converting a decimal number to a base of your own choosing, click here. If you would like to try converting from a base of your own choosing to a decimal number , click here.

Computer Graphics
If you work on web pages and graphics programs, you may find it helpful to convert between the RGB values (for an image in your graphics program) and the hexadecimal values (for a matching background color on the web page). Graphics programs deal with the RGB (red-green-blue) values for colors. Each of these components of a given color have values somewhere between 0 and 255. These values may be converted to hexadecimal values between 00 and FF. If you list the RGB components of a color as a string of three numbers, you might get, say, R:204, G:51, B:255, which translates into a light-purplish #CC33FF in HTML coding. Note that

20410 = CC16, 5110 = 3316, and 25510 = FF16.

On the other hand, if you have some coding for #990033, this would translate into a dark-reddish R:153, G:0, B:51 in your graphics program. That is, to convert between your graphics program and your webpage coding, deal with the hexadecimal number not as one six-digit number, but as three two-digit numbers, and convert these pairs of digits into the corresponding RGB values. For a discussion of the history of "web safe" colors, including why they involve only the hexadecimal equivalents of 0, 51, 102, 153, 204, and 255, look here. For a demonstration of the different text and background colors in HTML, look here.

Binary, Hexadecimal and Octal number system


Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of symbols used to represent numbers. In the decimal system, we use ten different symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. With these ten symbols, we can represent any quantity. For example, if we see a 2, then we know that there is two of something. For example, this sentence has 2 periods on the end..

When we run out of symbols, we go to the next digit placement. To represent one higher than 9, we use 10 meaning one unit of ten and zero units of one. This may seem elementary, but it is crucial to understand our default number system if you want to understand other number systems. For example, when we consider a binary system which only uses two symbols, 0 and 1, when we run out of symbols, we need to go to the next digit placement. So, we would count in binary 0, 1, 10, 11, 100, 101, and so on. This article will discuss the binary, hexadecimal, and octal number systems in more detail and explain their uses.

Fold Table of Contents How a Number System Works Binary Octal Hexadecimal Conversion Base to Decimal Decimal to Base How? Conversion. From decimal to binary From binary to decimal From decimal to hexadecimal. From hexadecimal to decimal From decimal to octal From octal to decimal Fun Facts End

How a Number System Works


Number systems are used to describe the quantity of something or represent certain information. Because of this, I can say that the word "calculator" contains ten letters. Our number system, the decimal system, uses ten symbols. Therefore, decimal is said to be Base Ten. By describing systems with bases, we can gain an understanding of how that particular system works. When we count in Base Ten, we count starting with zero and going up to nine in order.

0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
Once we reach the last symbol, we create a new placement in front of the first and count that up.

8, 9, 10, 11, 12, , 19, 20,

This continues when we run out of symbols for that placement. So, after 99, we go to 100.

The placement of a symbol indicates how much it is worth. Each additional placement is an additional power of 10. Consider the number of 2853. We know this number is quite large, for example, if it pertains to the number of apples in a basket. That's a lot of apples. How do we know it is large? We look at the number of digits. Each additional placement is an additional power of 10, as stated above. Consider this chart.

103 digit *1000

102 digit *100

101 digit *10

100 digit *1

Each additional digit represents a higher and higher quantity. This is applicable for Base 10 as well as to other bases. Knowing this will help you understand the other bases better.

Binary
Binary is another way of saying Base Two. So, in a binary number system, there are only two symbols used to represent numbers: 0 and 1. When we count up from zero in binary, we run out of symbols much more frequently.

0, 1,
From here, there are no more symbols. We do not go to 2 because in binary, a 2 doesn't exist. Instead, we use 10. In a binary system, 10 is equal to 2 in decimal. We can count further.

Binary Decimal

0 0

1 1

10 2

11 3

100 4

101 5

110 6

111 7

1000 8

1001 9

1010 10

Just like in decimal, we know that the more digits there are, the larger the number. However, in binary, we use powers of two. In the binary number 1001101, we can create a chart to find out what this really means.

26 1

25 0

24 0

23 1

22 1

21 0

20 1

64+0+0+8+4+0+1

87
Since this is base two, however, the numbers don't get quite as large as it does in decimal. Even still, a binary number with 10 digits would be larger than 1000 in decimal.

The binary system is useful in computer science and electrical engineering. Transistors operate from the binary system, and transistors are found in practically all electronic devices. A 0 means no current, and a 1 means to allow current. With various transistors turning on and off, signals and electricity is sent to do various things such as making a call or putting these letters on the screen. Computers and electronics work with bytes or eight digit binary numbers. Each byte has encoded information that a computer is able to understand. Many bytes are stringed together to form digital data that can be stored for use later.

Octal
Octal is another number system with less symbols to use than our conventional number system. Octal is fancy for Base Eight meaning eight symbols are used to represent all the quantities. They are 0, 1, 2, 3, 4, 5, 6, and 7. When we count up one from the 7, we need a new placement to represent what we call 8 since an 8 doesn't exist in Octal. So, after 7 is 10.

Octal Decim al

1 0 8

1 1 9

12 10

1 7 1 5

20 16

30 24

7 7 6 3

10 0 64

Just like how we used powers of ten in decimal and powers of two in binary, to determine the value of a number we will use powers of 8 since this is Base Eight. Consider the number 3623 in base eight.

83 3

82 6

81 2

80 3

1536+384+16+3 1939
Each additional placement to the left has more value than it did in binary. The third digit from the right in 3-1 3-1 binary only represented 2 , which is 4. In octal, that is 8 which is 64.

Hexadecimal
The hexadecimal system is Base Sixteen. As its base implies, this number system uses sixteen symbols to represent numbers. Unlike binary and octal, hexadecimal has six additional symbols that it uses beyond the conventional ones found in decimal. But what comes after 9? 10 is not a single digit but two Fortunately, the convention is that once additional symbols are needed beyond the normal ten, letters are to be used. So, in hexadecimal, the total list of symbols to use is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. In a digital display, the numbers B and D are lowercase. When counting in hexadecimal, you count 0, 1, 2, and so on. However, when you reach 9, you go directly to A. Then, you count B, C, D, E, and F. But what is next? We are out of symbols! When we run out of symbols, we create a new digit placement and move on. So after F is 10. You count further until you reach 19. After 19, the next number is 1A. This goes on forever.

Hexadeci mal Decimal

A 1 0

B 1 1

C 1 2

D 1 3

E 1 4

F 1 5

1 0 1 6

11 17

1 9 2 5

1 A 2 6

1 B 2 7

1C 28

9F 15 9

A 0 16 0

Digits are explained as powers of 16. Consider the hexadecimal number 2DB7.

163 2

162 D

161 B

160 7

8192+3328+176+7 11703
As you can see, placements in hexadecimal are worth a whole lot more than in any of the other three number systems.

Conversion
It is important to know that 364 in octal is not equal to the normal 364. This is just like how a 10 in binary is certainly not 10 in decimal. 10 in binary (this will be written as 10 2 from now on) is equal to 2. 108 is equal to 8. How on earth do we know this? What is 20C.38F16, and how do we find out? Here is why it is important to understand how the number systems work. By using our powers of the base number, it becomes possible to turn any number to decimal and from decimal to any number.

Base to Decimal

So, we know that 3648 is not equal to the decimal 364. Then what is it? There is a simple method in converting from any base to the decimal base ten. If you remember how we dissected the numbers 4 above, we used powers, such as 2 , and ended up with a number we understand. This is exactly what we do to convert from a base to decimal. We find out the true value of each digit according to their placement and add them together. In a formula, this algorithm looks like:

(1)

V10=vpBp+vp1Bp1+...+v1B+v0
Where V10 is the decimal value, v is the digit in a placement, p is the placement from the right of the number assuming the rightmost placement is 0, and B is the starting base. Do not be daunted by the formula! We are going to go through this one step at a time. So, let us say we had the simple hexadecimal number 2B. We want to know what this number is in decimal so that we can understand it better. How do we do this? Let us use the formula above. Define every variable first. We want to find V10, so that is unknown. The 1 number 2B16 has two positions since it has two digits. p therefore is one less than that , so p is 1. The number is in base 16, so B is 16. Finally, we want to know what v is, but there are multiple v's. You have v1 and v0. This refers to the value of the digit in the subscripted position. v1 refers to the digit in position one (the second digit from the right). So, v1 is 2. v0 is the first digit which is B. In the case of the conversion, you must convert all the letters to what they are in decimal. B is 11 in decimal, so v 0 is 11. Now, plug all this into the formula:

(2)

V10=2(161)+11(160)V10=2(16)+11(1)V10=32+11V10=43
Therefore, 2B16 is equal to 43. Now, let me explain how this works. Remember how digit placement affects the actual value? For 2 1 example, in the decimal number 123, the "1" represents 100 which is 1*10 . The "2" is 20, or 2*10 . 1 0 Likewise, in the number 2B16, the "2" is 2*16 , and the B is 11*16 . We can determine the value of numbers in this way. For the number 3648, we will make a chart that exposes the decimal value of each individual digit. Then, we can add them up so that we have the whole. The number has three digits, so starting from the right, we have position 0, position 1, and position 2. Since this is base eight, we will use powers of 8.

82 3

81 6
2

80 4
1 0

Now, 8 is 64. 8 is 8. 8 is 1. Now what? Remember what we did with the decimal number 123? We took the value of the digit times the respective power. So, considering this further

3*64 192

6*8 48

4*1 4

Now, we add the values together to get 244. Therefore, 3648 is equal to 24410. In the same way that for 123, we say there is one group of 100, two groups of 10, and three groups of 1, for octal and the number 364, there are three groups of 64, six groups of 8, and four groups of 1.

Decimal to Base
Just like how we can convert from any base to decimal, it is possible to convert decimal to any base. Let us say that we want to represent the number 23610 in binary, octal, and hexadecimal. What we need to do is pretty much reverse whatever we did above. There isn't really a good formula for this, but there is an algorithm that you can follow which will help accomplish what we want.

(3)

(1)LetP=int(VB)(2)Letv=int(VBP)(visthenextdigittotheright)(3)MakeV=VvBp(4)Repeatsteps 1through3untilp=0
This algorithm may look confusing at first, but let us go through an example to see how it can be used. We want to represent 236 in binary, octal, and hexadecimal. So, let's try getting it to binary first. The first step is to make p equal to int(VB). B is the base we want to convert to which is 2. The V is the number we want to convert, 236. Essentially, we are taking the square root of 236 and disregarding the decimal part. Doing this makes p become 7. Step two says to let v equal our number V divided by B . B is 2 , or 128, and the integer part of 236 divided by 128 is 1. Therefore, our first digit on the left is 1. Now, we actually change V to become V p minus the digit times the B . So, V will now be 236-128, or 108. We simply repeat the process until the p becomes a zero. When p becomes zero, we complete the steps a last time and then end. So, since V is now 108, p becomes 6. 108 divided by 2 is 1. The 1 goes to the right of the 1, so now we have 11. V becomes 44 since 108-64 is 44.
6 p p 7

How?
Now you might be asking yourself how to read these numbers. Well, thats not so difficult. First, Ill give a general mathematical explanation which can be fit into one formula:

(4)

V=vBP
In human language: the value of the cipher in the number is equal to the value of the cipher on its own multiplied by the base of the number system to the power of the position of the cipher from left to right in the number, starting at 0. Read that a few times and try to understand it.

Thus, the value of a digit in binary doubles every time we move to the left. (see table below) From this follows that every hexadecimal cipher can be split up into 4 binary digits. In computer language: a nibble. Now take a look at the following table:

Binary Numbers 8 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 4 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 2 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Hexadecimal Value 0 1 2 3 4 5 6 7 8 9 A B C D E Decimal Value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

15

Another interesting point: look at the value in the column top. Then look at the values. You see what I mean? Yeah, youre right! The bits switch on and off following their value. The value of the first digit (starting from the right), goes like this: 0,1,0,1,0,1,0,1,0,1, Second digit: 0,0,1,1,0,0,1,1,0,0,1,1,0,0 Third digit (value=4): 0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1, And so on Now, what about greater numbers? Therefore well need an extra digit. (but I think you figured that out by yourself). For the values starting from 16, our table looks like this:

Binary Numbers 16 1 1 1 1 1 1 1 1 1 1 1 1 8 0 0 0 0 0 0 0 0 1 1 1 1 4 0 0 0 0 1 1 1 1 0 0 0 0 2 0 0 1 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 Hexadecimal Value 10 11 12 13 14 15 16 17 18 19 1A 1B Decimal Value 16 17 18 19 20 21 22 23 24 25 26 27

1 1 1 1

1 1 1 1

1 1 1 1

0 0 1 1

0 1 0 1

1C 1D 1E 1F

28 29 30 31

For octals, this is similar, the only difference is that we need only 3 digits to express the values 1->7. Our table looks like this:

Binary Numbers 4 0 0 0 0 1 1 1 1 2 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 Octal Value 0 1 2 3 4 5 6 7 Decimal Value 0 1 2 3 4 5 6 7

Conversion.
In the latter topic I explained the logic behind the binary, hexadecimal and octal number systems. Now Ill explain something more practical. If you fully understood the previous thing you can skip this topic.

From decimal to binary

Step 1: Check if your number is odd or even. Step 2: If it's even, write 0 (proceeding backwards, adding binary digits to the left of the result). Step 3: Otherwise, if it's odd, write 1 (in the same way). Step 4: Divide your number by 2 (dropping any fraction) and go back to step 1. Repeat until your original number is 0.

An example: Convert 68 to binary: 68 is even, so we write 0. Dividing 68 by 2, we get 34. 34 is also even, so we write 0 (result so far - 00) Dividing 34 by 2, we get 17. 17 is odd, so we write 1 (result so far - 100 - remember to add it on the left) Dividing 17 by 2, we get 8.5, or just 8. 8 is even, so we write 0 (result so far - 0100) Dividing 8 by 2, we get 4. 4 is even, so we write 0 (result so far - 00100) Dividing 4 by 2, we get 2. 2 is even, so we write 0 (result so far - 000100) Dividing 2 by 2, we get 1. 1 is odd, so we write 1 (result so far - 1000100) Dividing by 2, we get 0.5 or just 0, so we're done. Final result: 1000100

From binary to decimal


Write the values in a table as shown before. (or do so mentally) Add the value in the column header to your number, if the digit is turned on (1). Skip it if the value in the column header is turned off (0). Move on to the next digit until youve done them all.

An example: Convert 101100 to decimal: Highest digit value: 32. Current number: 32 Skip the "16" digit, its value is 0. Current number: 32 Add 8. Current number: 40 Add 4. Current number: 44 Skip the "2" and "1" digits, because their value is 0. Final answer: 44

From decimal to hexadecimal.


THIS IS ONLY ONE OF THE MANY WAYS! Convert your decimal number to binary Split up in nibbles of 4, starting at the end Look at the first table on this page and write the right number in place of the nibble

(you can add zeroes at the beginning if the number of bits is not divisible by 4, because, just as in decimal, these dont matter) An example: Convert 39 to hexadecimal: First, we convert to binary (see above). Result: 100111 Next, we split it up into nibbles: 0010/0111 (Note: I added two zeroes to clarify the fact that these are nibbles) After that, we convert the nibbles separately. Final result: 27

From hexadecimal to decimal


*Check the formula in the first paragraph and use it on the ciphers in your hexadecimal number. (this actually works for any conversion to decimal notation) An example: Convert 1AB to decimal: Value of B = 16 11. This gives 11, obviously 1 Value of A = 16 10. This gives 160. Our current result is 171. 2 Value of 1 = 16 1. This gives 256. Final result: 427
0

From decimal to octal


Convert to binary. Split up in parts of 3 digits, starting on the right. Convert each part to an octal value from 1 to 7

Example: Convert 25 to octal First, we convert to binary. Result: 11001 Next, we split up: 011/001 Conversion to octal: 31

From octal to decimal


Again, apply the formula from above Example: convert 42 to decimal Value of 2=8 2=2 1 Value of 4=8 4=32 Result: 34
0

Fun Facts

OK, these may not be 100% "fun", but nonetheless are interesting. Do you tend to see numbers beginning with 0x? This is common notation to specify hexadecimal numbers, so you may see something like:

0x000000 0x000002 0x000004 This notation is most commonly used to list computer addresses, which are a whole different story. This is pretty obvious, but you can "spell" words using hexadecimal numbers. For example: o CAB = 3243 in decimal notation.

End
Did you understand everything? If you think so, test yourself:

Bin 101110 1011110

Dec 76 88

Hex 3A 47

Make some exercises yourself, if you want some more.

Footnotes
1. It is one less because the rightmost position is 0, not 1. So p is always one less than the number of digits.

Вам также может понравиться