# How a Calculator Works

The Naked Scientists spoke to Philippa Law interviews Dr Julian Allwood &amp; Dr Lucy Green
06 March 2005

## Interview with

Philippa Law interviews Dr Julian Allwood &amp; Dr Lucy Green

## NS_Logo_Pod_Teaser_215.png Philippa - This week, I'm going to find out how a calculator works. The first thing I want to find out is how it turns on in the first place. Dr Lucy Green from Cardiff University.

Lucy - When you put a calculator into the sun, the sunlight will fall onto a special solar panel. There are photons in the sunlight that hit the material in the solar panel and knock electrons out. Those electrons are now free to move about and they form a current. So it's a way of getting sunlight and changing it into electricity to power the calculator.

Philippa - What's Einstein got to do with all this?

Lucy - Einstein was the person who allowed us to understand the photoelectric effect. He was the person who proposed that light isn't made of a wave but is made of small packets of energy. This was absolutely revolutionary and changed everyone's views about light. So instead of thinking about it as a continuous wave, now we can also think about it as tiny packets of energy called photons. Most things we see behave as we see them behave. The table I'm sitting at is just a table, and always will be a table. With light, it depends on the situation it is in as to the form it is in. It took a great mind like Einstein to be able to understand it.

Philippa - It sounds like solar panels are the perfect solution to everything. How come we don't get solar powered televisions and hair-dryers?

Lucy - Solar energy is fantastic and is a clean source of energy, but the only problem is that solar panels don't generate very much electricity. So it's alright for something like a calculator. A solar panel about the size of my thumb will generate about 50 milliwatts. If you think of a 50 Watt light bulb, you would need about 1000 solar panels the size of my thumb just to get one light bulb shining. So they don't generate much electricity and they can be very expensive.

Philippa - So far so good: we've managed to switch the calculator on. How on earth does it work sums out? Dr Julian Allwood from Cambridge University.

Julian - That is a big question! The one thing a computer or a calculator can do is very simple: if you hold up two fingers, it can tell you whether there are two fingers there (in which case it says yes), or if you hold up more fingers or no fingers, it will say no. That in the end is all a computer can do. There's one variant in which the same question can be answered yes if any of the fingers are up. Those are the two operations which are at the heart of all computers. From that you can build up logic that will allow you to do addition and then multiplication and more difficult calculations.

Philippa - How does a calculator work out two plus two?

Julian - A calculator would represent two plus two as the binary numbers one - zero plus one-zero. Computers work only in binary. You can prove that it's faster for them to work only in zero and one rather than a wider scale of numbers. A computer would know that two was one-zero (10) and your other two was one-zero. Adding the first two digits, you've got zero plus zero. Its transistors would be able to say that that was zero and hold no fingers up. The next digits would be one plus one, and it would recognise that both of those were positive and both fingers were up. In that case, it would raise one finger in reply, which would lead to one digit being raised in the third part of the answer. So in binary, the answer to your question one-zero plus one-zero would equal one - zero-zero (100), which is four.

Example: The number 732 means 7 hundreds, 3 tens and 2 units. In the binary number system, there are only the numbers 0 and 1 to play with. Rather than working in units, tens and hundreds, it uses units, twos, fours, eights, sixteens, etc.

0 in binary is 0 1 in binary is 1 2 in binary is 10 3 in binary is 11 4 in binary is 100 5 in binary is 101

So, 10 (one-zero) + 10 (one-zero) = 100 (one-zero-zero)

Because 0 + 0 = 0, and 1 + 1 = 10 in binary. So 10 + 10 (2+2) = 100 (4)

Philippa - So now the calculator has done the sum, how does it tell us that the answer is 4?

Julian - We still have the problem that all the calculator knows how to do are ones and zeros. Unfortunately people don't usually speak binary when doing their shopping! So it has to have a display that converts that number into something that you're familiar with. If you look carefully at the numbers on the display of a calculator, you'll see that the numbers are actually made up of a number of short lines. So the display is made up of a set of things that are also 'on' or 'off'. The calculator therefore has another calculation that says one-zero-zero (100) means four to a human, or that one-zero-zero means a number of lines turned on in the display.