Help us understand the problem. What is going on with this article?

JuliaでVandermonde行列式を計算してみる

Vandermonde行列式

以下のように定義される行列をVandermonde行列[1]といいます.

A=\left(\begin{array}{cccc}1&1&\cdots&1\\x_1&x_2&\cdots&x_n\\\vdots&\vdots&\ddots&\vdots\\x_1^{n-1}&x_2^{n-1}&\cdots&x_n^{n-1}\end{array}\right)

Vandermonde行列の行列式は各行の公比の差積に等しく,以下のように表されます.

det(V)=\prod_{1\leq{i}<j\leq{n}}(x_j-x_i)=(-1)^{n(n-1)/2}\prod_{1\leq{i}<j\leq{n}}(x_i-x_j)

(証明)
帰納法によって証明する.

(i) $n=2$のとき

A=\left|\begin{array}{cc}1&1\\x_1&x_2\end{array}\right|=x_2-x_1

より成り立つ.

(ii) $n=k-1$のときに成り立つと仮定する.$n=k$のときを考えると,その行列式は

det(A)=\left|\begin{array}{cccc}1&1&\cdots&1\\x_1&x_2&\cdots&x_k\\x_1^2&x_2^2&\cdots&x_k^2\\\vdots&\vdots&\ddots&\vdots\\x_1^{k-1}&x_2^{k-1}&\cdots&x_k^{k-1}\end{array}\right|

これから,$2\sim{k-1}$行までの各行を$x_1$倍して次の行から引くと,

det(A)=\left|\begin{array}{cccc}1&1&\cdots&1\\0&x_2-x_1&\cdots&x_k-x_1\\0&x_2(x_2-x_1)&\cdots&x_k(x_k-x_1)\\\vdots&\vdots&\ddots&\vdots\\0&x_2^{k-2}(x_2-x_1)&\cdots&x_k^{k-2}(x_k-x_1)\end{array}\right|\\=\left|\begin{array}{ccc}x_2-x_1&\cdots&x_k-x_1\\x_2(x_2-x_1)&\cdots&x_k(x_k-x_1)\\\vdots&\ddots&\vdots\\x_2^{k-2}(x_2-x_1)&\cdots&x_k^{k-2}(x_k-x_1)\end{array}\right|\\=(x_2-x_1)\cdots(x_k-x_1)\left|\begin{array}{ccc}1&\cdots&1\\x_2&\cdots&x_k\\\vdots&\ddots&\vdots\\x_2^{k-2}&\cdots&x_k^{k-2}\end{array}\right|\\=(x_2-x_1)\cdots(x_k-x_1)\prod_{1\leq{i}<j\leq{k-1}}(x_j-x_i)\\=\prod_{1\leq{i}<j\leq{k}}(x_j-x_i)

以上より,証明された.

実際にプログラムによって実験して,上の関係が成り立つことを確認してみます.
対象のVandermonde行列式を,

det(A)=\left|\begin{array}{cccc}1&1&1&1\\2&3&5&4\\4&9&25&16\\8&27&125&64\end{array}\right|

として,Vandermonde行列式の式およびJuliaの関数による行列式の出力を比較します.

Juliaで実験


using LinearAlgebra

A = [1 1 1 1;
     2 3 5 4;
     4 9 25 16;
     8 27 125 64]

function vandermonde(A)
    det = 1
    for j in 2:4
        for i in 1:j-1
            det *= (A[2,j]-A[2,i])
        end
    end

    det
end

println("vandermonde: ", vandermonde(A))
println("det(A): ", det(A))

出力例

vandermonde: -12
det(A): -11.999999999999993

References

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした