16.7k views
3 votes
When is the following expression true? (2 points)

!(!a || b) || (!a && b)
1) If and only if a and b have different values
2) If and only if a and b have the same value
3)
If and only if both a and b are true
4) If and only if both a and b are false
5) The expression is never true

User Ken K
by
4.1k points

1 Answer

3 votes

Answer:

1) If and only if a and b have different values

Step-by-step explanation:

Given

Expression: !(!a || b) || (!a && b)

Required

When is it true?

The expression is true when the values a and b are different and the proof is as follows.

(1) Assume that: a = true and b = false

!(!a || b) || (!a && b)

= !(!true || false) || (!true && false)

!true = false, so the expression becomes:

= !(false|| false) || (false && false)

In boolean, false|| false = false and false && false = false. So, we have:

= !(false) || (false)

!(false) = true, so, the expression becomes:

= true || (false)

Lastly, true || false = true

(2) Assume that: a = false and b = true

!(!a || b) || (!a && b)

= !(!false|| true) || (!false && true)

!false = true, so the expression becomes:

= !(true|| true) || (true && true)

In boolean, true|| true = true and true && true = true. So, we have:

= !(true) || (true)

!(true) = false, so, the expression becomes:

= false|| true

Lastly, false || true = true

This expression is false if a and b have the same value

User Smar
by
4.3k points