Binary, base 2, bits, and coin flips

In summary: In both cases, we are finding a weighted sum).In decimal, we have ten symbols, so the biggest number we can write with a one-digit number (that is, one position) is 9.In binary, we have two symbols, so the biggest number we can write with a one-digit number (that is, one position) is 1 (one).In summary, the conversation discusses the concept of information processing in psychology and its relevance to the number of bits needed to represent different possibilities. The conversation also touches on how computers use binary code to represent numbers and the difference between the decimal and binary
  • #1
RabbitWho
153
18
I am studying psychology and have always been awful at maths (I think it's because I don't have much working memory), I am coming at this as a complete beginner. It is relevant to the Information Processing model of psychology.
_____

The book says: Imagine you throw a coin once.. once it lands you have 1 bit of information. There are two (2) possible results
[log2(2)] = 1 bit

If you throw a coin twice you have two bits of info, there are four possible results (xx,++,+x,x+) (I don't know why they mention the possible results, is that relevant?)
[log2(4)] = 2 bits

Am I right in thinking the 4 in that equation corresponds to the four possible results?

The examples in the book end there, and I have been trying to expand it to check that I understand.

[log2(8)] = how many bits? I guess that question means "How many binary digits do you need to represent 8?" There are 256 possible results.. is that relevant?

[log2(8)] =3 bits if we were talking about coin tosses, and 4 bits on a computer because for some reason they always add one. Am I right?In a computer
zero= 0
one = 1
two = 10
three = 11
four = 100

Why isn't 01 four?
Here I will guessfive = 101
six = 110
seven =111
eight = 1000

log base 2 of 8 is 3 so why do I need 8 digits to represent 8? Why can't I use 011?

A friend suggested that the computer would see 01 as being the same as 10. I am imagining a cent and a euro, they aren't the same coin so a tails with one is not the same as a tails with the other, they aren't interchangeable.. but I would have thought the same went for computer transistors? That is what 1 and 0 represent for computers, right? on and off switches?

_____

Thanks for any help you can give. I have googled it, but all the tutorials I find impart all the information relevant for IT then very quickly go into more advanced things like bytes etc. and don't deal in detail with the basic concept.
 
Computer science news on Phys.org
  • #2
RabbitWho said:
If you throw a coin twice you have two bits of info, there are four possible results (xx,++,+x,x+) (I don't know why they mention the possible results, is that relevant?)
[log2(4)] = 2 bits

Am I right in thinking the 4 in that equation corresponds to the four possible results?
Yes.
RabbitWho said:
The examples in the book end there, and I have been trying to expand it to check that I understand.

[log2(8)] = how many bits? I guess that question means "How many binary digits do you need to represent 8?" There are 256 possible results.. is that relevant?
You need 3 bits to represent one of eight possibilities.
RabbitWho said:
[log2(8)] =3 bits if we were talking about coin tosses, and 4 bits on a computer because for some reason they always add one. Am I right?
If you are talking about how many states can be coded, it would be 3 on a computer as well. If you are talking about encoding the number 8, then there is an extra bit - because the lowest number encoded by a bit string is usually zero. So you are counting from 0 to 8, nine different value - so you you ned more than 3 bits.
RabbitWho said:
In a computer
zero= 0
one = 1
two = 10
three = 11
four = 100

Why isn't 01 four?
You're not showing both bits.
In a computer
zero= 000
one = 001
two = 010
three = 011
four = 100

So 01 would be 001 - the code for one.
RabbitWho said:
Here I will guessfive = 101
six = 110
seven =111
eight = 1000

log base 2 of 8 is 3 so why do I need 8 digits to represent 8? Why can't I use 011?
Same as above - this time with four bits.
In a computer
five = 0101
six = 0110
seven =0111
eight = 1000

So 011 would be 0011 - the code for three.
RabbitWho said:
A friend suggested that the computer would see 01 as being the same as 10. I am imagining a cent and a euro, they aren't the same coin so a tails with one is not the same as a tails with the other, they aren't interchangeable.. but I would have thought the same went for computer transistors? That is what 1 and 0 represent for computers, right? on and off switches?
There are codes where a different number of bits (coin tosses) are use for different numbers. But in normal computer coding, there are fixed fields of bits - with a preset size. So if your number is eight and you are using 32-bit arithmetic, then you will see 00000000000000000000000000001000.
 
  • Like
Likes RabbitWho
  • #3
Thank you so much for your help. I think I understand.. So, for example

[log2(32)] = 5 bits?
 
  • #4
RabbitWho said:
Thank you so much for your help. I think I understand.. So, for example

[log2(32)] = 5 bits?
Yup!
 
  • Like
Likes RabbitWho
  • #5
RabbitWho said:
Thank you so much for your help. I think I understand.. So, for example

[log2(32)] = 5 bits?
log2(32) = 5, which is a number -- units should not be included.
Using 5 bits you can represent 32 numbers: 0, 1, 2, 3, ..., 31
The binary bit pattern for 31 (ie, in base-2) is 11111, which means ##1 \text{ x } 2^4 + 1 \text{ x } 2^3 + 1 \text{ x } 2^2 + 1 \text{ x } 2^1 + 1 \text{ x } 2^0 = 16 + 8 + 4 + 2 + 1 = 31##
 
  • Like
Likes RabbitWho
  • #6
RabbitWho said:
Thank you so much for your help. I think I understand.. So, for example

[log2(32)] = 5 bits?
Going the other way: A simple microcontroller handles information in 8 bit chunks (such a chunk is called a byte). What is the largest value you can represent in a byte?
 
  • Like
Likes RabbitWho
  • #7
In decimal the positions are weighted as powers of 10. In binary the positions are weighted as powers of 2

In decimal 10 symbols (0-9). The positions are (from right to left) 10^0, 10^1, 10^2 or 1, 10, 100
In binary 2 symbols (0-1). The positions are (from right to left) 2^0, 2^1, 2^2 or 1, 2, 4


Totally analagous
 
  • Like
Likes RabbitWho

1. What is binary?

Binary is a number system that uses only two digits, 0 and 1, to represent all values. It is also known as base 2 because each digit represents a power of 2.

2. What is base 2?

Base 2 is a number system that uses only two digits, 0 and 1, to represent all values. It is used in binary to represent numbers using powers of 2.

3. What is a bit?

A bit, short for binary digit, is the basic unit of information in computing and digital communications. It can have a value of either 0 or 1 and is used to represent data in binary form.

4. How are bits used in computing?

Bits are used in computing to represent data and instructions in binary form. They are the smallest unit of information and are used to store, transmit, and process data in computer systems.

5. What is a coin flip in binary?

A coin flip in binary is a simple demonstration of the binary number system. It involves assigning a 0 or 1 to represent heads or tails, respectively, and then flipping a coin to generate a binary number. This can be used to explain how binary works and its applications in computing.

Similar threads

  • Computing and Technology
Replies
4
Views
769
Replies
4
Views
932
  • Computing and Technology
Replies
0
Views
187
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Computing and Technology
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Computing and Technology
Replies
9
Views
2K
Replies
9
Views
1K
Replies
4
Views
5K
  • Precalculus Mathematics Homework Help
Replies
4
Views
1K
Back
Top