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
    • Invite by email
      Invitee

      This note has no invitees

    • 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
    • Note Insights New
    • Engagement control
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
  • Invite by email
    Invitee

    This note has no invitees

  • 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 西爾維斯特矩陣、結式 Sylvester matrix and resultant ![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/). $\newcommand{\trans}{^\top} \newcommand{\adj}{^{\rm adj}} \newcommand{\cof}{^{\rm cof}} \newcommand{\inp}[2]{\left\langle#1,#2\right\rangle} \newcommand{\dunion}{\mathbin{\dot\cup}} \newcommand{\bzero}{\mathbf{0}} \newcommand{\bone}{\mathbf{1}} \newcommand{\ba}{\mathbf{a}} \newcommand{\bb}{\mathbf{b}} \newcommand{\bc}{\mathbf{c}} \newcommand{\bd}{\mathbf{d}} \newcommand{\be}{\mathbf{e}} \newcommand{\bh}{\mathbf{h}} \newcommand{\bp}{\mathbf{p}} \newcommand{\bq}{\mathbf{q}} \newcommand{\br}{\mathbf{r}} \newcommand{\bx}{\mathbf{x}} \newcommand{\by}{\mathbf{y}} \newcommand{\bz}{\mathbf{z}} \newcommand{\bu}{\mathbf{u}} \newcommand{\bv}{\mathbf{v}} \newcommand{\bw}{\mathbf{w}} \newcommand{\tr}{\operatorname{tr}} \newcommand{\nul}{\operatorname{null}} \newcommand{\rank}{\operatorname{rank}} %\newcommand{\ker}{\operatorname{ker}} \newcommand{\range}{\operatorname{range}} \newcommand{\Col}{\operatorname{Col}} \newcommand{\Row}{\operatorname{Row}} \newcommand{\spec}{\operatorname{spec}} \newcommand{\vspan}{\operatorname{span}} \newcommand{\Vol}{\operatorname{Vol}} \newcommand{\sgn}{\operatorname{sgn}} \newcommand{\idmap}{\operatorname{id}} \newcommand{\am}{\operatorname{am}} \newcommand{\gm}{\operatorname{gm}} \newcommand{\mult}{\operatorname{mult}} \newcommand{\iner}{\operatorname{iner}}$ ```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, $$ \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 執行以下程式碼。 <!-- eng start --> Run the code below. <!-- eng end --> ```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)) ``` ##### Exercise 1(a) 寫出 $\mathcal{P}_2\times\mathcal{P}_1$ 的標準基底 $\alpha$、 以及 $\mathcal{P}_4$ 的標準基底 $\beta$。 <!-- eng start --> Find the standard basis $\alpha$ of $\mathcal{P}_2\times\mathcal{P}_1$ and the standard basis $\beta$ of $\mathcal{P}_4$. <!-- eng end --> ##### Exercise 1(b) 寫出 $p$ 與 $q$ 的西爾維斯特矩陣 $A$。 <!-- eng start --> Find the Sylvester matrix $A$ of $p$ and $q$. <!-- eng end --> ##### Exercise 1(c) 判斷 $p,q$ 是否互質。 <!-- eng start --> Determine if $\gcd(p,q) = 1$. <!-- eng end --> ## Exercises ##### Exercise 2 對以下的 $p$ 和 $q$﹐利用西爾維斯特矩陣判斷它們是否互質。 <!-- eng start --> For each pair of the following $p$ and $q$, find the Sylvester matrix of them and determine if $\gcd(p,q) = 1$. <!-- eng end --> ##### Exercise 2(a) $$ \begin{aligned} p &= 1 + 2x + x^2, \\ q &= 2 + x. \end{aligned} $$ ##### Exercise 2(b) $$ \begin{aligned} p &= 1 + 2x + x^2, \\ q &= 2 + 3x + x^2. \end{aligned} $$ ##### Exercise 2(c) $$ \begin{aligned} p &= 1 + 2x + x^2, \\ q &= 6 + 11x + 6x^2 + x^3. \end{aligned} $$ ##### Exercise 3 說明西爾維斯特矩陣 $S_{p,q}$ 就是 $[f]_\alpha^\beta$。 <!-- eng start --> Show that the Sylvester matrix $S_{p,q}$ is indeed $[f]_\alpha^\beta$. <!-- eng end --> ##### Exercise 4 執行以下程式碼。 嘗試各種不同的 $p,q$。 令 $A$ 為它們的西爾維斯特矩陣﹐ 將 $A$ 左上和右下翻轉後得到 $B$。 令 $R$ 為 $B$ 的最簡階梯形式矩陣。 觀察 $\gcd(p,q)$ 和 $R$ 的關係﹐並說明為什麼。 <!-- eng start --> Run the code below. Try different choices of $p$ and $q$. Let $A$ be their Sylvester matrix and $B$ the matrix obtained from $A$ by flipping along the skew diagonal (the one from bottom-left to top-right). Let $R$ be the reduced echelon form of $B$. Find a relation between $\gcd(p,q)$ and $R$ and provide your reasons. <!-- eng end --> ```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))) ``` ##### Exercise 5 令 $p,q$ 為兩多項式且 $g = \gcd(p,q)$。 證明 $$ \{ap + bq: a,b\in \mathcal{P}\} = \{ag: a\in\mathcal{P}\}. $$ <!-- eng start --> Let $p$ and $q$ be polynomials and $g = \gcd(p,q)$. Show that $$ \{ap + bq: a,b\in \mathcal{P}\} = \{ag: a\in\mathcal{P}\}. $$ <!-- eng end -->

    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