109 年 國立臺灣聯合大學系統(清華、政治、陽明交通、中央四校聯招)研究所電機類《離散數學》
第 1 題12 分
Let's play a game: Circle Game [12 points]
We have a circle with arbitrarily-chosen points for some natural number . Moreover, among the points, are labeled +1, while the remaining are labeled -1. Take the figure below as an example, which contains eight points with four nodes are labeled +1 and four are labeled -1.
🖼️【此處有附圖,請對照原卷】
Here's a game you can play. Pick one of the points as your starting point, then move clockwise around the circle. You lose the game if at any point on you pass through more -1 points than +1 points. You win the game if you get all the way back to your starting point without losing. For example, if you start at point C, the game would go like this:
Start at C: +1.
Pass through B: +2.
Pass through A: +1.
Pass through H: 0.
Pass through G: -1. (You lose.)
If you started at point G, the game would go like this:
Start at G: -1 (You lose.)
However, if you started at point F, the game would go like this:
Start at F: +1.
Pass through E: 0.
Pass through D: +1.
Pass through C: +2.
Pass through B: +3.
Pass through A: +2.
Pass through H: +1.
Pass through G: +0.
Return to F. (You win!)
No matter which points are labeled +1 and which points are labeled -1, there is always at least one point you can start at to win the game. Prove, by induction, that the above fact is true for any .
登入後即可作答並保存紀錄。
核心觀念
把每個標記 、 的點視為一個數字。從起點沿順時針方向依序經過各點時,累積和就是當下「 點數減去 點數」的差。
因此,起點能贏的條件是:從起點開始的每個累積和都不小於 。由於全圈有 個 與 個 ,走完一圈的總和恰為 。
解題方法:數學歸納法
基礎步驟:
圓上有一個 點與一個 點。從 點開始,累積和依序為 ,全程不小於 ,所以可以獲勝。
歸納假設
假設對某個 成立:任意由 個 與 個 組成的圓,都有一個起點能使沿途累積和不小於 。
歸納步驟
考慮有 個 與 個 的圓。順著行進方向,必定有一對相鄰點依序標為 :因為圓上同時有兩種標記,沿圈前進時至少會遇到一次由
第 2 題8 分
Brute force cannot solve everything. [8 points]
Use Fermat's Little Theorem to compute .
登入後即可作答並保存紀錄。
核心觀念
- 費馬小定理(Fermat's Little Theorem):
設 為質數,且 為整數。若 (即 與 互質),則:
- 同餘性質與指數降次(Exponent Reduction):
在同餘運算中,若 ,則對任意非負整數 ,皆滿足 。求大數字次方 時,可透過除法原理將指數 表示為 (其中 ),將式子化簡為:
解題方法
-
確認定理適用條件:
本題欲求 。- 模數 為質數。
- 底數 ,滿足 ( 與 互質)。
符合費馬小定理的適用前提。
-
套用費馬小定理:
由費馬小定理,取得週期同餘關係:
-
指數拆解與推導:
將指數 除以週期 ,得到商數與餘數:
利用次方的指數律展開:
第 3 題9 分
Define the relation. [9 points]
Below is a collection of pictures of binary relations.
🖼️【此處有附圖,請對照原卷】
Fill in the table below. No justification is necessary. However, you only get 3 points for a relation if all the answers for the relation are correct.
| Relation | Reflexive | Symmetric | Transitive | Irreflexive | Asymmetric | Equiv. Rel. | Strict Order |
|---|---|---|---|---|---|---|---|
| Relation 1 | |||||||
| Relation 2 | |||||||
| Relation 3 |
登入後即可作答並保存紀錄。
核心觀念
設二元關係為 :
- 反身性(Reflexive):對所有 ,皆有 。
- 對稱性(Symmetric):若 ,則 。
- 遞移性(Transitive):若 且 ,則 。
- 反自反性(Irreflexive):對所有 ,皆有 。
- 反對稱性中的非對稱(Asymmetric):若 ,則 。
- 等價關係(Equivalence Relation):反身、對稱且遞移。
- 嚴格序(Strict Order):反自反且遞移。
依原圖判讀:Relation 1 沒有自迴圈,右側為三個頂點形成的有向循環;Relation 2 為具有自迴圈且各群組內雙向連接的等價關係圖;Relation 3 為空關係。
解題方法與各關係判定
Relation 1
- 沒有任何頂點的自迴圈,因此不是反身,且是反自反。
- 圖中存在單向邊,但沒有對應的反向邊,因此不是對稱。
- 右側三點形成有向循環,例如 、,但沒有 ,所以不具遞移性。
- 雖然存在有向循環,但沒有互為反向的兩條邊,因此符合非對稱。
- 因為不具遞移性,所以不是嚴格序。
- 因為不是反身、對稱、遞移三者兼具,所以不是等價關係。
Relation 2
- 每個頂點都有自迴圈,因此具反身性。
- 圖中的連線皆成雙向,例如 同時有 ,因此具對稱性。
- 關係圖分成數個等價類;
第 4 題12 分
Let's exchange! [12 points]
Let and be spanning trees of with . Prove that there exists an edge , where and an edge , where so that both and are spanning trees.
登入後即可作答並保存紀錄。
核心觀念
-
生成樹 (Spanning Tree) 的基本性質:
設 為包含 個頂點的連通圖。若 為 的生成樹,則 為無迴圈的連通子圖,且其邊數必為 。 -
基本割集 (Fundamental Cutset):
若自生成樹 中移除任一邊 ,則 會恰好分裂為兩個不相交的連通元件(頂點集分別設為 與 )。原圖 中所有一個端點在 、另一個端點在 的邊所構成的集合稱為由 引發的基本割集 。注意: 中跨越此割集的邊恰好只有 本身,即 。 -
基本迴圈 (Fundamental Cycle):
若將不在生成樹 中的一條邊 加入 中,則 會包含唯一的一個迴圈,稱為由 引發的基本迴圈 。 -
割集與迴圈的正交性 (Cut-Cycle Intersection Theorem):
在任意圖形中,任何一個迴圈與任何一個割集的交集邊數必為偶數(即 條邊)。
解題方法
本題採用構造法 (Constructive Proof),利用基本割集與基本迴圈的正交性質來尋找同時滿足兩棵樹交換要求的邊。
詳細推導與證明步驟:
-
挑選邊 與建立割集 :
因為 與 為不同的生成樹(),且兩者邊數相等(均為 ),故集合差集 必然非空。
任意挑選一條邊 。
將 從 中移除,此時 分裂為兩個不相交的連通元件,其頂點集分別記為 與 ,其中 且 。
定義由 引發的割集為:
由割集定義可知 ,且在生成樹 中,跨越 與 的邊僅有 一條,即 。 -
構造邊 :
考慮將邊 加入生成樹 中。由於 ,圖形 中必存在唯一的迴圈,記作 。
因為 且 ,迴圈 包含至少一條屬於割集 的邊。
根據「割集與迴圈交集邊數必為偶數」的定理,迴圈 與割集 的交集 至少為 。
因此,在迴圈 中必存在另一條不同於 的邊 ,滿足:
-
驗證 :
- 由於 屬於迴圈 且 ,根據基本迴圈的定義,迴圈中除了 以外的所有邊都來自 ,故 。
- 又因為 ,而 在割集 中的邊只有 ,且 ,故 。
第 5 題10 分
Opportunity knocks but once. It's now or never. [10 points]
A robot moves on the two-dimensional integer grid. It starts out at (0,0) and is allowed to move in any of these four ways: [1] (+2,-1): right 2, down 1, [2] (-2,+1): left 2, up 1, [3] (+1,+3), an [4] (-1,-3). Prove that this robot can never reach (1,1).
登入後即可作答並保存紀錄。
核心觀念
本題屬於離散數學中的格點幾何(Grid Geometry)與不變量原理(Invariant Principle),亦可從**二元一次不定方程組(System of Diophantine Equations)**與整數格點空間的角度進行分析。
主要涵蓋以下核心觀念:
- 向量整數線性組合(Integer Linear Combination of Vectors):在二維整數格點 上,若機器人自原點 出發,經由允許的向量集合所能到達的任意點 ,必定可表為該組向量的整數係數線性組合。
- 聯立不定方程式的整數解判定:目標點是否可達,等價於對應的二元一次方程組是否存在整數解 。若解出之係數含有非整數(分數),則代表該目標點絕對無法到達。
- 同餘不變量(Modular Invariant):尋找一個線性映射 ,使得所有允許的位移向量在該映射下皆滿足特定模數(Modulo)的同餘特性。若目標點不滿足該同餘性質,即證明其不可達。
解題方法
【方法一:整數聯立方程組求解(標準推導)】
機器人的四種允許移動向量分別為:
注意到 與 分別為 與 的反向向量。因此,機器人自原點 出發,移動任意步數後所達到的座標 ,皆可表示為 與 的整數線性組合:
其中 代表沿 方向的淨移動步數, 代表沿 方向的淨移動步數。
將其拆解為 與 的分量方程式:
將目標點 代入方程組:
求解此聯立方程式:
由式 (1) 可得 ,代入式 (2):
再將 代回求 :
第 6 題12 分
Coloring the graph, coloring your life. [12 points]
Let the vertices of a graph G be the integers . The numbers are connected if they are not relatively prime numbers. Find the chromatic number of G, i.e., the minimum number of colors for coloring the nodes so that two nodes connected by an edge are with different colors.
登入後即可作答並保存紀錄。
題目簡析
給定圖 ,點集 。當 且 (即不互質)時, 與 相連。求圖 的著色數(Chromatic Number, )。
觀念與解題步驟
-
考慮獨立集與著色數的下界(Cliques):
著色數 至少等於圖中最大團(Maximum Clique)的大小 ,亦即 。考慮質數 :
- 最多只能選擇 8 個彼此互質的質數。
- 任何大於 1 的合數必含有至少一個質因數。
在集合 中,任意兩數均互質,因此它們在圖 中互相沒有連線(屬於獨立集)。
反過來,考慮以下 8 個頂點構成的子圖:
?更直接地,尋找互相連線的頂點子集(Clique):
選擇點集 不成立(任意兩數均含有公因數 2,故任意兩數都有邊相連)。小於等於 40 的質數共有 12 個:。
考慮點集 。更精準地,圖 的補圖 中,兩點相連當且僅當它們互質。
求 等價於將 拆分成最少個獨立集,亦即在補圖 中拆分成最少個團(Clique Cover)。 -
質數分類著色法:
頂點 1 與其他所有頂點均互質,故 1 在 中為孤立點(Degree 0),可單獨塗一色或與任意點同色。將所有大於 1 的元素 按其最小質因數(Smallest Prime Factor, SPF)分類:
- 最小質因數為 2 的元素:。這些數兩兩皆有公因數 2,故在 中形成一個團(Clique)。要為這個團著色,每個元素必須用不同顏色嗎?不,團中的點互相有邊相連,故團內的每一點都必須著不同顏色!
正確分析補圖與著色:
- 中兩點有邊 。
- 著色規則:若兩點顏色相同,則它們之間不能有邊 (兩數必須互質)。
第 7 題12 分
Clique, clique. [12 points]
A k-clique is a graph with k nodes where each node is connected to the k-1 other nodes in the graph. Now, suppose that you take a k-clique and color each edge either red or blue. Prove the following result by induction: if the k-clique contains an odd-length cycle made only of blue edges, then it must contain a cycle of length three with an odd number of blue edges (that is, a cycle of length three with exactly one blue edge or exactly three blue edges.)
登入後即可作答並保存紀錄。
命題
設 為一個 -clique,且其每條邊被著色為紅色或藍色。若 中包含一個僅由藍邊組成的奇數長度迴路(奇藍迴路),則 中必包含一個邊長為 3 且擁有奇數條藍邊(即恰有 1 條或 3 條藍邊)的迴路(三角型)。
證明
對藍邊奇迴路的長度 進行數學歸納法。由於迴路由邊組成,奇迴路長度 且 為奇數。
-
基礎步驟(Base Step):
當 時,該迴路本身即為一個長度為 3 的迴路,且包含 3 條藍邊(3 為奇數)。命題顯然成立。 -
歸納假設(Inductive Hypothesis):
假設長度為 (其中 且 為奇數)的所有藍邊奇迴路,所在圖中均包含至少一個具奇數條藍邊的三角形。 -
歸納步驟(Inductive Step):
考慮長度為 ( 且 為奇數)的藍邊奇迴路 。
因為原圖為 -clique,點 與 之間必定存在一條邊 。
討論邊 的顏色:- 情況一:邊 為藍色
邊 將迴路 切割成兩個較短的藍邊迴路:- ,長度為 3。
- ,長度為 。
由於 為長度 3 的全藍迴路(有 3 條藍邊),即已找到符合條件的三角形。
- 情況二:邊 為紅色
- 情況一:邊 為藍色
第 8 題19 分
Master is not enough (go for PhD?). [19 points]
(a) [5 points] Give an example of recurrences that is in the form of but cannot be solved with Master theorem.
(b) [14 points] Now, let's try to use the recurrence tree method to solve the time complexity of recurrence in the -notation.
登入後即可作答並保存紀錄。
(a) Master Theorem 無法適用的遞迴關係式範例與原因
Master Theorem 要求遞迴式 滿足 , ,且 與 之間必須滿足多項式漸進比較(polynomial condition)或常數比較條件。
反例
無法使用 Master Theorem 的原因
- 此式中 , ,故 。
- 雖然 ,但 。
- 由於 的成長速度低於任何 (),因此 並非多項式大於(polynomially larger) (即不存在 使得 ),不符合 Master Theorem 的 Case 3;同時它也不符合 Case 1 與 Case 2。
(b) 使用遞迴樹法(Recurrence Tree Method)求解
遞迴關係式:
假設邊界條件 。
1. 樹的結構與各層工作量分析
- 第 層(樹根):
- 子問題個數:
- 每個子問題規模:
- 本層總工作量:
第 9 題6 分
Wild Guess. [6 points]
How many 0s are at the end of 20! when written in octal (base-8)? Briefly explain your answer.
登入後即可作答並保存紀錄。
核心觀念
- 數進位制與結尾 0 的意義:整數 在 進位制下的末尾 0 個數,等於能整除 的 之最高次方數,即求最大整數 使得 。
- 進位底數的質因數分解:若進位底數 為合數,必須將其分解為質因數乘積。八進位底數為 ,因此求 等價於求 。
- 勒讓德定理(Legendre's Formula):用於計算 中質因數 的最高次方數 :
解題方法
-
計算 中質因數 2 的最高次方數
代入勒讓德定理公式,計算 各項:
加總可得:
即 可被 整除,但無法被 整除。 -
轉換為八進位底數 的次方數
欲使 ,亦即 。