Eli5: Computers can calculate based on instructions. But how do you teach computers what does it mean to add something, multiply, divide, or perform any other operation?

904 views

Edit: Most of the answers here are wonderful and spot on.

For those who interpreted it differently due to my incorrect and brief phrasing, by ‘teaching’ I meant how does the computer get to know what it has to do when we want it to perform arithmetic operations (upon seeing the operators)?

And how does it do it? Like how does it ‘add’ stuff the same way humans do and give results which make sense to us mathematically? What exactly is going on inside?

Thanks for all the helpful explanations on programming, switches, circuits, logic gates, and the links!

In: 583

43 Answers

Anonymous 0 Comments

The computer (transistors) is just following the rules of physics (electricity). Adding is a human concept that just so happens to be based around an objective law (law of conservation) of nature. The computer follows the laws of nature and we assume it is adding, when it is us who interpret it as adding.

Anonymous 0 Comments

Your submission has been removed because it concerns, or has been prompted by, a recent or current event. Recent events are a topic not covered in ELI5 under rule 2. It’s possible posted about before, even if this is not the case. Please search the subreddit before posting. If this is about a recent/current event, please consider trying a sub such as /r/news, /r/worldnews, /r/OutOfTheLoop, or /r/NoStupidQuestions. Please make sure to read their rules and their current megathreads (if related).

If you would like this removal reviewed, please read the [detailed rules](https://www.reddit.com/r/explainlikeimfive/wiki/detailed_rules) first. **If you believe this submission was removed erroneously**, please [use this form](https://old.reddit.com/message/compose?to=%2Fr%2Fexplainlikeimfive&subject=Please%20review%20my%20thread?&message=Link:%20/r/explainlikeimfive/comments/140fza9/eli5_computers_can_calculate_based_on/%0A%0APlease%20answer%20the%20following%203%20questions:%0A%0A1.%20The%20concept%20I%20want%20explained:%0A%0A2.%20List%20the%20search%20terms%20you%20used%20to%20look%20for%20past%20posts%20on%20ELI5:%0A%0A3.%20How%20does%20your%20post%20differ%20from%20your%20recent%20search%20results%20on%20the%20sub:) and we will review your submission. Note that **if you do not fill out the form completely**, your message **will not be reviewed**.

*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/explainlikeimfive) if you have any questions or concerns.*

Anonymous 0 Comments

The basic logic gates of AND, OR, NOT can be combined to perform addition. Other instructions come from addition.