Jephian Lin
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# 西爾維斯特矩陣、結式 ![Creative Commons License](https://i.creativecommons.org/l/by/4.0/88x31.png) This work by Jephian Lin is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). {%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %} ```python from lingeo import random_int_list from linspace import vtop, ptov, syl ``` ## Main idea Let $p$ and $q$ be two polynomials. The **greatest common divisor** of $p$ and $q$ is the polynomial $g$ of largest degree such that $g \mid p$ and $g\mid q$. This polynomial is unique up to scalar multiplication, so usually we let $\gcd(p,q)$ be the one with leading coefficeint $1$. By the Euclidean algorithm, it is known that the following two sets are equal. $$\{ap + bq: a,b\in \mathcal{P}\} = \{ag: a\in\mathcal{P}\}, $$ where $=\mathcal{P}$ is the set of all polynomials. A refined version is as follows. Let $p$ and $q$ be two polynomials of degree $m$ and $n$, respectively. Then $$\{ap + bq \in\mathcal{P}_{m+n}: a\in\mathcal{P}_{n-1},b\in\mathcal{P}_{m-1}\} = \{ag \in\mathcal{P}_{m+n}: a\in\mathcal{P}\}. $$ Given two polynomials $p, q$ of degrees $m,n$, consider the function $$\begin{array}{rccc} f : & \mathcal{P}_{n-1} \times \mathcal{P}_{m-1} & \rightarrow & \mathcal{P}_{m+n-1} \\ & (a,b) & \mapsto & ap + bq \\ \end{array}, $$ which is linear. Thus, $$\operatorname{range}(f) = \{ap + bq \in\mathcal{P}_{m+n-1}: a\in\mathcal{P}_{n-1},b\in\mathcal{P}_{m-1}\} = \{ag \in\mathcal{P}_{m+n-1}: a\in\mathcal{P}\}, $$ where $g = \gcd(p,q)$. Therefore, $f$ is surjective if and only if $\gcd(p,q) = 1$. Let $\alpha_q = \{1,\ldots, x^{n-1}\}$ and $\alpha_q = \{1,\ldots, x^{m-1}\}$ be the standard bases of $\mathcal{P}_{n-1}$ and $\mathcal{P}_{m-1}$. Let $$\alpha = \{(a,0): a\in\alpha_p\} \cup \{(0,b) : b\in\alpha_q\}. $$ Then $\alpha$ is a basis of $\mathcal{P}_{n-1}\times\mathcal{P}_{m-1}$. On the other hand, let $\beta$ be the standard basis of $\mathcal{P}_{m+n-1}$. Construct the $(m + n)\times (m + n)$ matrix $$S_{p,q} = \begin{bmatrix} | & ~ & | & | & ~ & | \\ [p]_\beta & \cdots & [x^{n-1}p]_\beta & [q]_\beta & \cdots & [x^{m-1}q]_\beta \\ | & ~ & | & | & ~ & | \\ \end{bmatrix}. $$ Then $S_{p,q} = [f]_\alpha^\beta$ and is called the **Sylvester matrix** of $p$ and $q$. The determinant of $S_{p,q}$ is called the **resultant** of $p$ and $q$, denoted as $\operatorname{res}(p,q)$. (We have not learnt the properties of the determinant, but at least it make senses when $S_{p,q}$ is a small matrix.) Let $p,q$ be two polynomials. Let $S_{p,q}$ their Sylvester matrix and $\operatorname{res}(p,q)$ the resultant. Then the following are equivalent: 1. $\gcd(p,q) = 1$. 2. $f$ is surjective. 3. $f$ is injective. 4. $S_{p,q}$ is invertible. 5. $\operatorname{res}(p,q)\neq 0$. ## Side stories - gcd by row operations - multiple root ## Experiments ##### Exercise 1 執行以下程式碼。 ```python ### code set_random_seed(0) print_ans = False m,n = 2,3 p = vtop(vector(random_int_list(m+1))) q = vtop(vector(random_int_list(n+1))) print("p =", p) print("q =", q) A = syl(p,q) if print_ans: print("alpha = {(1,0), (x,0), (x^2,0), (0,1), (0,x)}") print("beta = {1, x, x^2, x^3, x^4}") print("Spq =") show(A) print("gcd(p,q) = 1?", (A.determinant() != 0)) ``` `set_random_seed(0)` $p= 5x^2 + 3x - 4$ $q=3x^3 - 5x - 5$ $\alpha = \{(1,0), (x,0), (x^2,0), (0,1), (0,x)\}$ $\beta = \{1, x, x^2, x^3, x^4\}$ $$S_{p,q}=\begin{bmatrix} -4&0&0&-5&0\\ 3&-4&0&-5&-5\\ 5&3&-4&0&-5\\ 0&5&3&3&0\\ 0&0&5&0&3 \end{bmatrix} $$ ##### Exercise 1(a) 寫出 $\mathcal{P}_2\times\mathcal{P}_1$ 的標準基底 $\alpha$、 以及 $\mathcal{P}_4$。 :::warning - [x] 標點 ::: $Ans$ 由 $\mathcal{P}_2$ 的標準基底 $\alpha_2=\{1, x, x^2\}$, 和 $\mathcal{P}_1$ 的標準基底 $\alpha_1=\{1,x\}$, 而 $\mathcal{P}_2\times\mathcal{P}_1$ 的標準基底 $\alpha = \{(a,0): a\in\alpha_2\} \cup \{(0,b) : b\in\alpha_1\}$。 得知 $\alpha= \{(1,0), (x,0), (x^2,0), (0,1), (0,x)\}$, $\mathcal{P}_4$ 的標準基底為 $\{1,x,x^2,x^3,x^4\}$。 ##### Exercise 1(b) 寫出 $p,q$ 的西爾維斯特矩陣 $A$。 :::warning - [x] 標點 - [x] 句子要完整 ::: $Ans$ 西爾維斯特矩陣為 $$S_{p,q} = \begin{bmatrix} | & ~ & | & | & ~ & | \\ [p]_\beta & \cdots & [x^{n-1}p]_\beta & [q]_\beta & \cdots & [x^{m-1}q]_\beta \\ | & ~ & | & | & ~ & | \\ \end{bmatrix}. $$ 將 $n=3$ , $m=2$ , $p= 3x^3 - 5x - 5$ , $q=5x^2 + 3x - 4$ 代入, 得到 $p,q$ 的西爾維斯特矩陣 $A=\begin{bmatrix} -4&0&0&-5&0\\ 3&-4&0&-5&-5\\ 5&3&-4&0&-5\\ 0&5&3&3&0\\ 0&0&5&0&3 \end{bmatrix}$。 ##### Exercise 1(c) 判斷 $p,q$ 是否互質。 :::warning - [x] 標點 ::: $Ans$ 是,$S_{p,q}$ 經過列運算之後,發現沒有自由變數,表示此矩陣可逆,也就代表 $\gcd(p,q) = 1$ 得 $p,q$ 互質。 ## Exercises ##### Exercise 2 對以下的 $p$ 和 $q$﹐利用西爾維斯特矩陣判斷它們是否互質。 ##### Exercise 2(a) $p = 1 + 2x + x^2$、 $q = 2 + x$。 :::warning - [x] 中英數間空格 - [x] $det$ --> $\det$ - [x] 後面幾小題一樣 ::: Ans $$ S_{p,q}=\begin{bmatrix} 1&2&0\\ 2&1&2\\ 1&0&1 \end{bmatrix} $$ 由於 $\det(S_{p,q})=1\neq 0$,說明了 $S_{p,q}$ 為一可逆矩陣,也代表 $\gcd(p,q) = 1$,因此多項式 $p$ 跟 $q$ 互質。 ##### Exercise 2(b) $p = 1 + 2x + x^2$、 $q = 2 + 3x + x^2$。 ANS $$ S_{p,q} = \begin{bmatrix} 1&0&2&0\\ 2&1&3&2\\ 1&2&1&3\\ 0&1&0&1 \end{bmatrix} $$ 針對高階的矩陣,我們可以利用拉普拉斯展開法降階以獲取行列式值。 \ 由於 $\det(S_{p,q})=0$,說明了 $S_{p,q}$ 為一不可逆矩陣,也代表 $\gcd(p,q)\neq 1$,因此多項式 $p$ 跟 $q$ 不是互質。 ##### Exercise 2(c) $p = 1 + 2x + x^2$、 $q = 6 + 11x + 6x^2 + x^3$。 ANS $$ S_{p,q}=\begin{bmatrix} 1&0&0&6&0\\ 2&1&0&11&6\\ 1&2&1&6&11\\ 0&1&2&1&6\\ 0&0&1&0&1 \end{bmatrix} $$ 由於 $\det(S_{p,q})=0$,說明了 $S_{p,q}$ 為一不可逆矩陣,也代表 $\gcd(p,q)\neq 1$ ,因此多項式 $p$ 跟 $q$ 不是互質。 ##### Exercise 3 說明西爾維斯特矩陣 $S_{p,q}$ 就是 $[f]_\alpha^\beta$。 :::success good ::: 令 $$\begin{array}{rccc} f : & \mathcal{P}_{n-1} \times \mathcal{P}_{m-1} & \rightarrow & \mathcal{P}_{m+n-1} \\ & (a,b) & \mapsto & ap + bq \\ \end{array}, $$ 又令 $\alpha$ 為 $\mathcal{P}_{n-1} \times \mathcal{P}_{m-1}$ 的基底,而 $\beta$ 為 $\mathcal{P}_{m+n-1}$ 的基底。 而 $\alpha = \{(1,0),(x,0),(x^2,0),...,(x^{n-1},0),(0,1),(0,x),(0,x^2),...,(0,x^{m-1})\}$ 。 接著觀察 $[f]_\alpha^\beta$ 。 依照定義, $[f]_\alpha^\beta$ 為將 $\alpha$ 內的向量一一代入 $f$ 並用 $\beta$ 表示出來的矩陣,即 $$ [f]_\alpha^\beta = \begin{bmatrix} | & | & | & ~ & | & | & ~ & | \\ [f(1,0)]_\beta & [f(x,0)]_\beta & [f(x^2,0)]_\beta & ... & [f(x^{n-1},0)]_\beta & [f(0,1)]_\beta & ... & [f(0,x^{m-1})]_\beta \\ | & | & | & ~& | & | & ~ & | \end{bmatrix}。 $$ 而觀察將 $\alpha$ 內的向量代入 $f$ 的結果,會發現 $f(1,0) = p,f(x,0) = px,...,f(x^{n-1},0) = px^{n-1},f(0,1) = q,f(0,x^{m-1} = qx^{m-1})$ , 則 $$ [f]_\alpha^\beta = \begin{bmatrix} | & ~ & | & | & ~ & | \\ [p]_\beta & \cdots & [x^{n-1}p]_\beta & [q]_\beta & \cdots & [x^{m-1}q]_\beta \\ | & ~ & | & | & ~ & | \\ \end{bmatrix}$ 即 $S_{p,q}. $$ ##### Exercise 4 執行以下程式碼。 嘗試各種不同的 $p,q$。 令 $A$ 為它們的西爾維斯特矩陣﹐ 將 $A$ 左上和右下翻轉後得到 $B$。 令 $R$ 為 $B$ 的最簡階梯形式矩陣。 觀察 $\gcd(p,q)$ 和 $R$ 的關係﹐並說明為什麼。 ```python p = 1 + x q = 1 + 2*x + x**2 A = syl(p,q) B = A.antitranspose() R = B.rref() print("A =") show(A) print("B =") show(B) print("R =") show(R) print("gcd =", p.polynomial(QQ).gcd(q.polynomial(QQ))) ``` :::warning - [x] $gcd$ --> $\gcd$ - [x] 中英數間空格 - [x] 填上係數後可以發現皆有 $p,q$ 的公因式存在 --> 填上係數後可以發現皆是 $\gcd(p,q)$ 的倍式 - [x] 且在矩陣$R$中,因為是由矩陣$B$所推倒而來,前幾列為 $p,q$ 被整理過後的一元二次式,因此也會有相同的公因式。 --> 且在矩陣 $R$ 中,任一列都是 $B$ 中列向量的線性組合,其所對應到的多項式皆為 $ap + bq$ 的形式,所以均是 $\gcd(p,q)$ 的倍式。而最後一個非零列的次方數最小,所以它就是 $\gcd(p,q)$。 ::: 答: 當 $p = 1 + x$, $q = 1 + 2x + x^2$ 時 $$A=\begin{bmatrix} 1&0&1\\ 1&1&2\\ 0&1&1\\ \end{bmatrix},B=\begin{bmatrix} 1&2&1\\ 1&1&0\\ 0&1&1\\ \end{bmatrix},R=\begin{bmatrix} 1&0&-1\\ 0&1&1\\ 0&0&0\\ \end{bmatrix},\gcd(p,q) = x+1 .$$ 當 $p = 1 + x^2$, $q = 1 + 2x$ 時 $$A=\begin{bmatrix} 1&1&0\\ 0&2&1\\ 1&0&2\\ \end{bmatrix},B=\begin{bmatrix} 2&1&0\\ 0&2&1\\ 1&0&1\\ \end{bmatrix},R=\begin{bmatrix} 1&0&0\\ 0&1&0\\ 0&0&1\\ \end{bmatrix},\gcd(p,q) = 1 .$$ 當 $p = 2 + x$, $q = 4 + 8x + 3x^2$ 時 $$A=\begin{bmatrix} 2&0&4\\ 1&2&8\\ 0&1&3\\ \end{bmatrix},B=\begin{bmatrix} 3&8&4\\ 1&2&0\\ 0&1&2\\ \end{bmatrix},R=\begin{bmatrix} 1&0&-4\\ 0&1&2\\ 0&0&0\\ \end{bmatrix},\gcd(p,q) = x+2 . $$ 矩陣最下方不為零的列,按照順序從高次到低次排序,分別是 $x^2, x^1, x^0$,填上係數就是 $p,q$ 的公因式。其中在矩陣 $R$ 的第一列由上往下到不為零的前一列,填上係數後可以發現皆是 $\gcd(p,q)$ 的倍式,且在矩陣 $R$ 中,任一列都是 $B$ 中列向量的線性組合,其所對應到的多項式皆為 $ap + bq$ 的形式,所以均是 $\gcd(p,q)$ 的倍式。而最後一個非零列的次方數最小,所以它就是 $\gcd(p,q)$。 ##### Exercise 5 令 $p,q$ 為兩多項式且 $g = \gcd(p,q)$。 證明 $$\{ap + bq: a,b\in \mathcal{P}\} = \{ag: a\in\mathcal{P}\}. $$ :::warning 一邊是簡單的,$ap + bp$ 一定是 $cg$ 的形式。 另一邊要用到除法原理。 這題我直接掛懸賞。 ::: *ANS* 因為 $g$ 為 $p,q$ 公因式,因此我們可令 ${\{ap=g: a\in\mathcal{P}\}}$ ,${\{bq=g: d\in\mathcal{P}\}}$ ,不會了 :::info 目前分數 6.5 :::

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully