PS1sol 2023 v2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

CS131 Problem Sheet 1

Due Monday 30th January 2023 at 12 noon, Tabula submission (a .pdf file).

No submissions after the deadline.


Write clearly and show all your working for each question.

1. Convert the hexadecimal value 7E7sixteen to binary.

Solution:

7E7sixteen = 14· 162 + 14· 16 + 7· 160


= (111two )· 28 + (1110two )· 24 + (0111two )· 20
= 111000000002 + 11100000 + 0111
= 11111100111

24
2. If 1234567654321eight ≡ x with −24 < x ≤ 0, what is x?

Solution: There are many ways to solve this. Perhaps the most straightfor-
ward one is to convert into decimal number and then take the modulo 24 of
that number.
Here’s another way which is shorter, but requires some non-trivial steps. Note
8
that 24 = 8∗3, and 1234567654321eight ≡ 1. Thus, the remainder of 1234567654321eight
when divided by 24 is either 1, 9, 17, that is, the possible candidates for x are
−7, −15, −23, respectively. To identify which one of these is the correct answer,
we need to check for the modulo 3 result of 1234567654320eight (after subtract-
ing 1 from the original number).
3
We have 8 ≡ −1, so

3
1234567654320eight ≡ (−1) ∗ 123456765432eight
3
= (−1)· 811 + (−2)· 810 + · · · + (−2)· 80 ≡
1· (−1)12 + 2· (−1)11 + · · · + 2· (−2)0 =
(1 − 2) + (3 − 4) + (5 − 6) + (7 − 6) + (5 − 4) + (3 − 2) = −3 + 3 = 0.
3
That is, 1234567654320eight ≡ 0. We also know that modulo 24 of 1234567654320eight
is either −8, −16, −24, respectively. Among this, the only option that has 0
modulo 3 is -24. Hence
24 24
1234567654321eight = 1234567654320eight · +1 ≡ −24 + 1 ≡ −23.
3. Use the Euclidean Algorithm to find the GCD of 6772 and 2775 (for the curious
minds, these are the numbers of the current year 2023 in the Assyrian and Julian
Calendars, respectively).

Solution: The working of the Euclidean Algorithm goes like this:

6772 = 2· 2775 + 1222 (1)


2775 = 2· 1222 + 331 (2)
1222 = 3· 331 + 229 (3)
331 = 1· 229 + 102 (4)
229 = 2· 102 + 25 (5)
102 = 4· 25 + 2 (6)
25 = 12· 2 + 1 (7)
2 = 2· 1 + 0 (8)

So the GCD is 1 (the last non-zero remainder).

4. Prove that log12 18 is irrational.

Solution: Suppose for contradiction that log12 18 = m/n for m, n ∈ Z. Observe


that we may assume that m/n > 1 since 18 > 12. Additionally, we may assume
that m > 0 and n > 0.
We have 12m/n = 18 ⇐⇒ 12m = 18n ⇐⇒ 22m−n = 32n−m . Note that 2m − n is
positive, since m > n and m and n are positive. Thus 32n−m must be divisible
by 2, which is impossible since 2 and 3 are coprime.

√ !2023
2 1
5. Find the real and imaginary parts of − −√ .
2 −2

Solution: Note that

√ !2023 √ √ !2023
2 1 2 2
− −√ = − + i .
2 −2 2 2
√ √ √
This is because √1 = √1 = √ − 2i√ = − 2i
. Therefore − √1−2 = 2i
.
−2 2i 2i(− 2i) 2 2
√√
2 2
Now we write − + i in polar coordinates:
2 2
√ √
2 2
− + i = cos(3π/4) + i· sin(3π/4).
2 2
By De Moivre’s theorem, we get
√ √ !2023
2 2
− + i = cos(6069π/4) + i· sin(6069π/4)
2 2
= cos(5π/4) + i· sin(5π/4)
1 1
= −√ − √ i
2 2
Therefore
√ !2023
2 1 1 1
− −√ = − √ − √ i,
2 −2 2 2
and thus the real and imaginary parts are both − √12 respectively.

√ √
6. Find the set of unit vectors in R2 which are at an angle of π/6 to ( 3, 6).

Solution: Recall that, for any two vectors u and v, we have u · v = |u||v| cos θ,
where θ is the angle between the vectors.

3
√ √ √
Since cos(π/6) = and |( 3, 6)| = 3, we seek a vector (x, y) such that 3x +
√ √ 2
6y = 3 2 3 and x2 + y 2 = 1, since (x, y) is a unit vector.

By rearranging the first equation, we obtain x = 32 − 2y. By substituting this
√ 2
in the second equation, we get 1 = 32 − 2y + y 2 . Therefore y satisfies the
√ 5
quadratic equation y 2 − 2y + 12 = 0. Since


  
2 5 1 1 1 1
y − 2y + = y−√ − √ y−√ + √ ,
12 2 2 3 2 2 3

the two possible values for y are √12 ± 2√1 3 . Thus the two desired vectors are
   
1 √1 , √1 + √
1 1 √1 , √1 − √
1
2
− 6 2 2 3
and 2
+ 6 2 2 3
.

Marking scheme: 1 point for each question answered correctly, 0.5 point for partial answer, 0
point otherwise.
Max number of points: 6.

You might also like