CSCI 190 Exam I practice solutions
1)
a) If the streets are not wet, then it is not raining.
b)
All Mt. SAC students are not international students.
c) P: study hard, q: get A’s r: get rich.
p (q r )
~ q ~ r
__________
This is valid by Modus tollens
~P
2)
Prove or disprove each of the following:
a) For the domain of real numbers,
x( x x 2 )
Solution: false. As a counter example, let x=0.5. Then
x x2
b) For the domain of integers, xy ( xy 0)
Solution: this is true. Let x=0. Then 0(y)=0 for all y.
Solution:
Let x=1. Then for any positive number y, 1 y
3)
Prove that
3n 9 is odd if and only if n is even.
Solution: First show if
3n 9 is odd, then n is even.
n 2k 1 for some positive integer k. Then
3n 9 3(2k 1) 9 6k 3 9 2(3k 6) . Therefore 3n 9 is even.
Use contrapositive. Suppose n is odd. Thus
Next show if
n is even, then 3n 9 is odd.
n 2k for some positive integer k. Then
3n 9 3(2k ) 9 6k 9 2(3k 4) 1 . Therefore 3n 9 is odd.
Suppose n is even. Thus Thus
4) Solution: Choose
x A . Then since A B A , x A B , that is x A and x B . Therefore
x B by addition.
5) Solution: Suppose there is the largest integer x. Then
x 1is an integer large than x. This
contradicts the statement that x is the largest integer. Therefore there is no largest
integer.
6)
(Four points each)
a) Show
3n 2 n is O(n 2 ) .
Use the fact that
b) Show n is not
3
n n 2 . 3n 2 n 3n 2 n 2 4n 2 . Therefore 3n 2 n is O(n 2 ) .
O(n 2 )
Proof by contradiction: suppose n is
3
O(n 2 ) . Then n3 Cn 2 for some C for large n values. But
n3 Cn 2 n C , which states all natural numbers are less than some constant C. But this is
impossible since there is no largest natural number.
7) (four points) Compute the Boolean Product
1 0
0 0
and B
A B for A
0 1
1 1
0 0 0 0 0 0
A B
0 1 0 1 1 1
8) (Four points each)
x for x in [2, 2]
b) Show f : Z Z Z defined as f (m, n) m n is onto. Justify your answer.
a) Sketch
Proof: Let
a Z (pick a typical element in the codomain. Then f (a, 0) a 0 a
. Thus f is
onto.
9) (8 points) Find the close form (non-recursive form)of the recursive sequence
an 2nan1 ,
a0 5 .
an 2nan 1
2n((2)( n 1)an 2 ) 22 n(n 1)an 2
Solution:
22 n(n 1)(2(n 2)an 3 ) 23 n(n 1)(n 2)an 3
2n n !a0
2n n ! 5
10) (2 points each: true/false, short answers: No partial credit points will be given. You are
not required to show work.)
a) True/False: Let A, B be sets. If
Solution: False: For example,
A B , then A B
A {1, 2}, B {3, 4,5} A has fewer elements than B, but A is not a
subset of A
b) True/False:
x x
for all real numbers x (including negative numbers)
Solution: True.
x is the greatest integer LESS THAN OR EQUAL TO x.
c) True/False: Determine if the following statement is true or false:
1 1 56 if and only if
30 16 25 :
Solution: This is a true statement:
p q is true since p is false and q p is true since q is
false.
d) Is the set of rational numbers countable or uncountable? ___Countable____________
e) Is the set of real numbers countable or uncountable? ____Uncountable.
f)
Rewrite the following sentence in “If P then Q” form. I pass CSCI 190 only if I study 10
hours a week.
________________________Solution: If I pass CSCI 190, then I study 10 hour a week. _______________
g) Find the power set of A ,{} Solution: P( A) { ,{},{{}} ,{} ______________
h) Find
i)
n
n
i 1
i 1
Ai where Ai {1,2,3i} Solution:
Compute
2
2
(2i j)
Ai {1} ______
Solution: (2 1) (2 2) (4 1) (4 2) 18
i 1 j 1
j)
Find the nth term of the sequence 0,3,8,15,
Solution: an n 1 _______________
2
f ([2, 2]) and f 1 ([0, 2]) : f ([2, 2]) all the y-values for x in f ([2, 2]) and [0, 2] [0, 4] and
k)
f 1 ([0,2]) looking for all the x-values when y is in [0, 2] [ 2, 2]
l)
Let A, B be
n n
matrices with C=AB. Find an expression for
cij (using
) given
n
A [aij ], B [bij ], C [cij ] Solution: cij aik bkj
k 1
11) Prove if a b and b c , then a c for nonzero integers a,b,c.
Pf: Since a b ,
b ak for some integer k. Similarly, since b c , c bs for some integer s. But
b ak and c bs c (ak ) s a(ks) . Since ks is an integer, a c .
12) Show
f (n) n2 3n 1 is (n 2 )
Solution:
f (n) n2 3n 1 n2 3n2 n2 5n2 . Thus f (n) n2 3n 1 is O(n2 )
On the other hand,
f (n) n2 3n 1 n2 . Thus f (n) n2 3n 1 is (n2 ) . Therefore,
f (n) n2 3n 1 is (n 2 )
13)
{1,2,3} . True. The empty set is a subset of any set.
b) (1 point) True/False: } {1,2,3} False. {1, 2,3} does not contain the element
c) (2 points) Find the power set of {a , b} : Solution: { ,{a},{b},{ab}}
a) (1 point) True/False:
d) (2 points) For A {1,2} and B {3,7} , find A B .
Solution {(1,3), (1, 7), (2,3), (2, 7)}
14) Find a non-recursive expression for an 2an 1 1, a0 1
Solution:
an 2an 1 1
2(2an 2 1) 1 22 an 2 2 1
22 (2an 3 1) 2 1 23 an 3 2 2 2 1
2n a0 2n 1 2n 2
1
2n 1
2 1
n 1
2 1
2n
15) Determine if f : Z Z Z defined by f (m) 6m 2n is onto.
Solution: No, it is not onto. It is impossible to find an integer m with f (m, n) 3 since
6m 2n 2(3m 1) is always even.
16) Prove that ~ ( p q ) is logically equivalent to p (~ q )
Solution:
P
q
T
T
F
F
T
F
T
F
pq
T
F
T
T
~ ( p q)
~q
F
T
F
F
F
T
F
T
p (~ q )
F
T
F
F
~ ( p q) is logically equivalent to p (~ q ) since their entries in the truth table are identical.
17)
Prove that if a b , then a b c for integers a,b,c.
Pf: Since a b ,
b ak for some integer k. Multiply both sides by c. b ak bc a(kc) . Since
kc is an integer, a b c .
18) Prove or disprove the following:
xy ( y x) , where the domain is the set of all natural numbers 1, 2, 3, ….
Solution: True. Let x=1. Then for any natural number y,
19) Construct a truth table to determine if
P
T
T
F
F
Solution:
q
T
F
T
F
( p q)
F
T
T
F
p ( p q)
T
T
T
F
They are not equivalent.
20) Show that if
A B then A B B
p ( p q) p
y 1.
A B B . Let x A B . We need to show x B . x A B , so x A or
x B . Case1) If x A , then since A B , x B Case 2) x B . Then we are done. In
both cases x B
c) Next show B A B . Pick x B . We need to show x A B . But if x B then a fortiori
x A or x B . Therefore x A B .
Pf: a) First show
Since
A B B and B A B , A B B .
21) Suppose x is a nonzero real number. Prove that if
1
is an irrational number, then x is also
x
an irrational number.
Pf: Use contradiction. Suppose x is a rational number. Then x
Then
a
for nonzero integers a, b.
b
1 b
1
with a nonzero a. Contradiction since
is an irrational number. Thus x is an
x
x a
irrational number
22) Prove or disprove:
a) For the domain of real number xy
( x y 0)
Solution: False: This says you can find x such that x plus any number is 0. For x = 0,
then let y=1. Then x+y is not 0. For x not 0, let y=x. Then x+y is 2x, which is not 0.
b) For the domain of real numbers,
xy ( x y 0)
Solution: true. This says any real number has an additive inverse. For any x, set y=-x.
Then x+y=0.
23) Prove that there is no positive integer satisfying
x 3 4 x 20
Pf : Use exhaustive proof: You only need t try x=1 and x=2 since
33 exceeds 20.
13 4(1) 20, 23 4(2) 20 . Therefore there is no positive integer satisfying x 3 4 x 20
24) (2 points each) Do NOT show work.
a) True/False {1,2}
Solution: True. The empty set is a subset of every set.
b) Write the negation of
Solution:
x y p( x, y)
c) Find an integer
Solution: a=11
xy p( x, y) . Make sure the negation appears next to p(x,y).
6 a 13 such that a 4(mod 7) ______________
d) [5,9]
e) Negate the following sentence: Nancy is tall and beautiful.
___________Solution: Nancy is not tall or Nancy is not beautiful.
f)
Pf:
1.2 1.2 =_______________________
1.2 1.2 1.2 (2) 0.8 0
m)
1
f 1 ({0,1, 2}) looking for all the x-values when y is in 0,1, 2 : f ( x) 0 3n 1 0 n ,
3
2
not an integer. f ( x) 1 3n 1 1 n 0 , f ( x ) 2 3n 1 2 n , not an integer.
3
1
f ({0,1,2}) {0}
g) P= there is gas in the car, q= I will not drink beer, r= I will go shopping.
pq
qr
~r
No conclusions can be drawn.
_____
X
25)
a) (7 points) Find a formula (in closed form) for the recursive sequence
an an 1 n, a0 1
Solution:
an an 1 n,
an 2 (n 1) n
an 3 (n 2) (n 1) n
a0 1 2
n
n(n 1)
2
2
n n2
2
1
b) (3 points) Find the nth term of the sequence 2, 6,18,54,
an 2(3n 1 )
xy( x 2 y 2 4) , where the domain is the set of all real numbers.
2
Solution: This statement is false. Let x=3. Then 9 y 4 has no solution.
26) Prove or disprove:
27) Prove or disprove:
f : R R defined by f ( x) x3 1 is a bijection.
Solution: This is true. A) 1-1: Suppose
c) Onto: Pick y in the codomain.
f ( x) f ( y ) . Then x3 1 y 3 1 x y
x3 1 y x 3 y 1 : i.e. f ( 3 y 1) y . Thus f is onto.
28)
a) For a function
f : R R defined by f ( x) x 2 1 , find a) f 1[1,5] and b)
f [1,5]
Solution:
a)
f 1[1,5] {x : f ( x) [1,5]} : that is , all the x-values whose corresponding y-values falls in
the range [1,5]. Using common sense,
b)
f 1[1,5] [2, 2]
f [1,5] { y : f ( x) for 1 x 5} : that is , all the y-values whose corresponding x-values
falls in the range [1,5]. Using common sense,
29) Prove that
2 is irrational.
Pf: Proof by contradiction. Suppose
number,
f [1,5] [2, 26]
2
2 is rational.
Then by the definition of a rational
a
for integers a and b. We may assume the gcd of a and b is 1.
b
a
a 2b . Next square both sides to get a 2 2b 2 . Thus a 2 even. So a is even. Write
b
a as a 2k for some k. a 2 2b 2 now becomes (2k )2 2b2 2k 2 b2 b is also even. But
2
this is a contradiction since the gcd of a and b is 1. Therefore
30)
If
m n is odd, then n and m are both odd.
2 is irrational.
Pf: Proof by contrapositive: Show if m is odd and n is odd, then mn is odd.
Pf: Since m and n are odd, m 2k 1, n 2l 1, k .l Z Then mn (2k 1)(2l 1) 2(2 ml m l ) 1 is
odd.
31)
a) Show n! O(n n )
Pf: n! n(n 1)(n 2)
(1) n(n)(n)
n nn . Thus n! O(n n ) with C=1.
b) Show 2 O(n!)
n
Pf: 2n 2(2)(2)
C) Show
(2) 2(1(2)(3)
n) 2n! . Therefore 2n O(n!) with C=2
3n O(2n ) . Proof by contradiction. Suppose 3n O(2n ) . Then there is a constant C
n
3
such that 3 C 2 for large n. Dividing both side by 2 , 3 C 2 C . But this is
2
impossible since an exponential function with base greater than 1 increases to as n
n
n
grows. Thus 3 O(2 ) .
n
n
n
n
n
2
32) Prove that if a b , then a b for integers a,b,
2
Pf: since a b , b ak for some integer k. Square both side b ak b a k . Since k
2
2
integer, a b .
2
2
2
2
is an
© Copyright 2026 Paperzz