Illustrated · 1 min

We will start with the basic units, the 00 and the 11. 00 is used to represent "false" and 11 is used to represent "true." A boolean variable is a variable takes the value either 00 or 11. A boolean operation is a function that takes in some number of boolean variables and outputs either 00 or 11. By this definition, boolean operations can easily be written out using truth tables, in which we list every possible input and then write what the operation gives for each one.

There are three main operators on boolean variables: NOT (¬\neg), AND (∧\land), OR (∨\lor). They are described in the following truth tables below. Essentially, NOT flips the value, AND checks if both are true, and OR determines if at least one of them are true.

Logic

Truth tables for NOT, AND, OR.

To read these truth tables: for any input, the output is in the rightmost column. So if you wanted to determine 1∧01\land0, go to the middle truth table, look for the row in which x=1x=1 and y=0y=0, then look at that same row in the x∧yx\land y column to see that 1∧0=01\land0=0.

Here we will show a proof by truth table that ¬((¬x)∧(¬y))\neg((\neg x)\land(\neg y)) and x∨yx\lor y are logically equivalent, which means these two functions give the same value for all inputs.

Logic

First we found ¬x\neg x, then ¬y\neg y, ANDed those two columns together, and then NOTted the whole thing. Since the last column (the function we want to prove equivalent to x∨yx\lor y) has the same truth table as x∨yx\lor y, they are the same on all inputs, and thus are equivalent.

Binary is a very convenient system for working with logical statements. To convert a binary number to base 1010 (decimal), we sum up the kkth digit times 2k2^k, so if the number is 1101100111011001 then we sum up 1⋅20+0⋅21+0⋅22+1⋅23+1⋅24+0⋅25+1⋅26+1⋅27=2171\cdot2^0+0\cdot2^1+0\cdot2^2+1\cdot2^3+1\cdot2^4+0\cdot2^5+1\cdot2^6+1\cdot2^7=217.

To convert from decimal to binary, we continually subtract the largest power of 22 less than the number and try to reverse engineer the above definition. So for 100100, subtract 64=2664=2^6, then from 100−64=36100-64=36 subtract 32=2532=2^5, then 36−32=4=2236-32=4=2^2. So 100=26+25+22=1100100100=2^6+2^5+2^2=1100100. There is also another way that involves finding the number mod 2, 4, 8, etc but this gets complicated.

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems