Solution of Homework 2: Language of Mathematics
Q1. Prove
AB =AB
without using the De Morgans law and Venns Diagram.
Answer
To prove that two sets are equal, we need to prove that each set is a subset of the
other:
i) To prove that A B A B :
x A B
xAB
/
[50] Homework 4. Proof Techniques
Each problem is worth 10 points
[10] Show that
3
3 is irrational.
[10] Show that 3 divides n3 + 2n whenever n is a nonnegative integer.
[10] Let A be a set of cardinality n. Let P (A) be the power set, that is, the set of
CS182 Spring 2013 Homework 7
Prof. Alex Pothen and Prof. Vernon Rego
Due date: Friday April 26, 2013
(LE1: Before Class; LE2: 9 A.M. in CS undergrad oce).
Late HW will not be accepted.
1. (10 points)
(a) Use the Extended Euclidean algorithm to nd an inver
CS 182 Fall 2010
Michael S. Kirkpatrick
Name:
MIDTERM #1
This is an open book, open notes exam. However, you are not allowed to share any
material with anyone else during the exam. Any evidence of academic dishonesty will be
dealt with strictly in accorda
Solution of Homework 3
* Note that the approximate functions shown below are not unique and
are provided for the sake of illustration not perfection.
Prob. 1
n
n!
e
Using Stirlings formula:
n
n
2n
ln k
= ln n ! n (ln n 1 ) + 0 . 5 ln( 2 n )
k =1
Algori
CS 182 Fall 2009
Prof. Ananth Grama
Final Exam
Answer Key
PROBLEM 1
Let P (x, y ) be the statement x-y = x+y. The domain for both variables is the set of all
integers Z. What are the truth values of the following? Justify your answer.
a. (2 pts) P (1, 1)
CS182 Spring 2013 Homework 3
Prof. Alex Pothen and Vernon Rego
Due date: Friday, February 22, 2013 (before class).
1. (4pts) Find these terms of the sequence cfw_an , where an = (2)n + 5n.
(a) a0 .
(b) a1 .
(c) a3 .
(d) a6 .
2. (12pts) Find f (1), f (2),
[30] Homework 3. Programming Assignment
The goal of this assignment is to find good approximations of
(2) Hn
=
1 k2 k=1
n
and n! = 1 2 3 n for large n (n ). [15] Evaluation of (Zeta Function) Hn : Tabulate and plot Hn for a range of n (e.g
[50] Homework 2. Language of Mathematics Each problem is worth 10 points [10] Prove that for any sets A and B A = (A - B) (A B). [10] Let x and y be integers. Determine whether the following relations are reflexive, symmetric, antisymmetric, or tra
CS182 Spring 2013 Homework 1
Prof. Alex Pothen and Vernon Rego
Due date: Friday, January 25th, 2013 (before class).
1. (8pts) Show that each of these implications is a tautology by using truth tables.
(a) [q (p q )] q .
p q pq
TT
T
TF
F
FT
T
FF
T
q (p q )
CS182 Foundations of Computer Science
Homework 6 (50 points)
Problem 1.
(50 points)
1. (5 points) Prove or disprove: For all integers a, b, c, d, if a|b and c|d, then (ac)|(b+d).
Solution. The statement is false. Here is a counter example:
3|9 & 2|4 ; 6 -
Module 1: Basic Logic
Theme 1: Propositions
English sentences are either true or false or neither. Consider the following sentences:
1. Warsaw is the capital of Poland.
2.
.
3. How are you?
The first sentence is true, the second is false, while the last o
Homework 3 Solutions:
Avinash Singh
P-08
0029335365
Language used: Mathematica
Question 1:
The function given is a Harmonic Function, where the number of terms is extremely
large. We first plot the function using the following command:
ListPlot[Table[Harm
Avinash Singh
PUID: 0029335365
PSO: P08
CS 182 Home Work 6
1. (5 points) Prove or disprove: For all integers a, b, c, d, if a|b and c|d, then (ac)|(b + d).
Ans. This statement is false. When a = 3, b = 6, c = 4 and d = 8
a|b is true because 3|6
c|d is
Avinash Singh
PUID: 0029335365
PSO: P08
CS 182 Home Work 6
1. (5 points) Prove or disprove: For all integers a, b, c, d, if a|b and c|d, then (ac)|(b + d).
Ans. This statement is false. When a = 3, b = 6, c = 4 and d = 8
a|b is true because 3|6
c|d is tru
Models of Computation
1
Computation
CPU
memory
2
temporary memory
input memory
CPU
output memory
Program memory
3
Example: f ( x) x
3
temporary memory
input memory
CPU
output memory
Program memory
compute
compute
xx
2
x x
4
f ( x) x
temporary memory
3
inp
/*
* Created by kavya1998 on 2/20/17.
*/
public class Calc cfw_
public static void main(String[] args) cfw_
double i = 0.25;
double sum = 0;
while(i<=3.75)cfw_
sum = sum +
Math.pow(Math.exp(1),3*Math.sqrt(i) *
Math.sin(7*i);
i = i+0.5;
sum = (0.5)* sum;
Solutions of Homework #4: Proof Techniques
Q1. Show that
5
5 is irrational.
Answer
Proof by contradiction: Assume that 5 5 = pq is in its simplest form, i.e., both p
and q do not have a common divisor and therefore the fraction pq cannot be
simplified fur
#include <stdlib.h>
#include <stdio.h>
int main ()cfw_
int numbers[] = cfw_1,2,3,4,5;
unsigned int n = 5;
unsigned int i = 0;
long int sum = 0;
for(i = 0; i<n; i+)cfw_
sum = sum+ numbers[i];
printf("The sum is %ld\n", sum);
Module 5: Basic Number Theory
Theme 1: Division
Given two integers, say
and , the quotient
may or may not be an integer (e.g.,
but
). Number theory concerns the former case, and discovers criteria upon which one can
decide about divisibility of two intege
CS182 Foundations of Computer Science
Homework 7 (50 points)
Problem 1.
(50 = 10 * 5 points)
In this problem, a word is any string of seven (7) letters of the English alphabet, with repeated letters allowed. Also, we will consider Y to be a vowel.
Provide
CS182 Foundations of Computer Science
Homework 8 (50 points)
Remark: Provide a brief justification for each of your answers (no more than
five lines or so), explaining which counting rules you used and what your thought
process was. Finally, feel free to
CS182 Foundations of Computer Science
Homework 6 (50 points)
Problem 1.
(50 points)
1. (5 points) Prove or disprove: For all integers a, b, c, d, if a|b and c|d,
then (ac)|(b + d).
2. (5 points) Prove or disprove: For all integers a, b, c, if a|bc, then a
CS182 Foundations of Computer Science
Solutions for Homework 7
Problem 1. In this problem, a word is any string of seven (7) letters of the English alphabet, with
repeated letters allowed. Also, we will consider Y to be a vowel.
Provide a brief justificat
CS182 Foundations of Computer Science
Homework 8 (50 points)
Remark: Provide a brief justification for each of your answers (no more than five lines or so), explaining
which counting rules you used and what your thought process was. Finally, feel free to