Lecture 1 and 2 Flashcards
Lecture 1 notes
How to convert Binary to Decimal format
To convert binary to decimal format, starting with the leftmost digit add together 1 x 2^n.
Example- 1110011 is equivalent to 115. 1x2^6 + 1 x 2^5 + 1 x 2^4 + 1 x 2^1 + 1 x 2 ^0. You exclude any that have a 0 in the slot.
How to convert decimal to binary format?
To convert decimal to binary format you continually divide by 2 and track the remainder and then read the remainders backwards.
How to convert decimal to hexadecimal?
To convert decimal to hexadecimal you divide the number by 16 and read the remainders backwards.
How to convert binary to hexadecimal?
To convert binary to hexadecimal you split the binary into groups of 4 and if there is an uneven group of less than 4 add a 0 to the left hand side.
How to convert binary into octal
To convert binary to octal you split the binary into group of 3
How to express a decimal based fraction in binary?
Start by splitting the whole number portion and the fraction
Then multiply the fraction portion by 2 and record the 1 on a separate column and continue to only multiply the fraction portion.
What is the double negative law?
~(~p) = p
What is the commutative law
p v q = q v p
What is the Associative Law?
(p v q) v r = p v (q v r) and
p ^ q) ^ r = p^ (q^r
What is the distributive law?
p ^ (q v r) = (p^ q) v (p^r) and p v (q^r) = (p v q) ^ (p v r)
What is Demorgan’s Law
~(p v q) = ~p ^ ~q
~(p ^ q) = ~p v ~q
Difference between predicate and proposition?
In contrast predicate logic distinguishes the subject of a sentence from its predicate.
i.e “The dog is sleeping”
the phrase is sleeping is the predicate and is symbolized by P(x)
How do you rewrite p XOR q?
2 ways:
- (p v q) ^ ~(p ^ q)
- (p ^ ~q) v (q ^ ~p)
How to rewrite p –> q
~p v q
How to rewrite p q
2 Ways:
- (p –> q) ^ (q –>p)
- ~(p XOR q)