NivaarExam PrepOfficial exam papers ↗

04-BS-16 · December 2014

Question 12 of 12

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

National Examination, 04-BS-16 Discrete Mathematics, December 2014. Closed book; approved calculator and one double-sided aid sheet permitted. The exam instructs "answer any 10 of 12 questions, best 10 marks taken"; every question is answered below as a complete study resource.

Reference texts: Rosen, Discrete Mathematics and Its Applications, 7th ed. (Pearson) — used throughout for logic, set theory, induction, combinatorics, probability, functions, recurrence relations, graph theory, and asymptotic (Big-O) notation.

Question 12

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. (a1) $f(n)=5n^2+3n\log_2n$. (a2) $f(n)=2+4+6+\cdots+2n$. (b) The integers $1369$ and $2597$.

Find. (a) The tightest simple Big-O bound for each function. (b) $\gcd(1369,2597)$, and integers $a,b$ with $\gcd=1369a+2597b$ (Bezout's identity).

Approach. Compare growth rates term-by-term for (a) (a lower-order log factor never changes the Big-O class set by the dominant polynomial term); run the Euclidean algorithm forward for the gcd, then back-substitute (extended Euclidean algorithm) for the Bezout coefficients.

  1. a1) Bound $5n^2+3n\log_2n$. Since $\log_2n\le n$ for all $n\ge1$, we have $3n\log_2n\le3n^2$, so $f(n)\le5n^2+3n^2=8n^2$ for all $n\ge1$ — a valid Big-O witness with $C=8,k=1$. The $n^2$ term dominates the smaller-order $n\log n$ term, and no lower power of $n$ bounds $f$ (the $5n^2$ term alone already grows like $n^2$). $\boxed{f(n)=O(n^2)}$.
  2. a2) Bound $2+4+\cdots+2n$. This is $2(1+2+\cdots+n)=2\cdot\frac{n(n+1)}{2}=n(n+1)=n^2+n$. Since $n^2+n\le2n^2$ for all $n\ge1$, $C=2,k=1$ is a valid witness. $\boxed{f(n)=n^2+n=O(n^2)}$.
  3. b) Run the Euclidean algorithm forward. Repeatedly divide-and-remainder, larger by smaller:
    Euclidean algorithm on 1369, 2597
    StepDivisionQuotient $q$Remainder $r$
    1$2597 = 1\cdot1369 + 1228$11228
    2$1369 = 1\cdot1228 + 141$1141
    3$1228 = 8\cdot141 + 100$8100
    4$141 = 1\cdot100 + 41$141
    5$100 = 2\cdot41 + 18$218
    6$41 = 2\cdot18 + 5$25
    7$18 = 3\cdot5 + 3$33
    8$5 = 1\cdot3 + 2$12
    9$3 = 1\cdot2 + 1$11
    10$2 = 2\cdot1 + 0$20
    The last nonzero remainder is $1$, so $\boxed{\gcd(1369,2597)=1}$.
  4. b) Back-substitute to find $a,b$ (extended Euclidean algorithm). Running the coefficient recurrence $(s,t)$ forward alongside the same divisions (each new remainder's coefficients $=$ previous pair's minus $q\times$ current pair's) yields, at the final step where the remainder reaches $1$: $$1 = (-1013)\times1369 + 534\times2597$$ Direct check: $(-1013)(1369)=-1{,}386{,}797$ and $(534)(2597)=1{,}386{,}798$, summing to $1$. $\boxed{\gcd(1369,2597)=1=(-1013)(1369)+(534)(2597)}$, i.e. $a=-1013,\ b=534$ (Bezout coefficients; not unique — any $a+2597k,\ b-1369k$ for integer $k$ also works).
Question 12 results
PartResult
a1$O(n^2)$
a2$O(n^2)$ (exactly $n^2+n$)
b$\gcd(1369,2597)=1=(-1013)(1369)+(534)(2597)$
Back to the paper →