ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 07 Apr 2021 23:02:52 +0200How to construct a class of matrices satisfying a given matrix equation.https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/![image description](/upfiles/16175450459866355.png)
Here we know that $A=I_n$ satisfies the given matrix equation. But can we find other non trivial matrix ($\neq I_n$). In other words, can we construct a class of matrices satisfying the given matrix equation.
Please help regarding this.Sun, 04 Apr 2021 16:06:55 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/Comment by ortollj for <p><img src="/upfiles/16175450459866355.png" alt="image description"> </p>
<p>Here we know that $A=I_n$ satisfies the given matrix equation. But can we find other non trivial matrix ($\neq I_n$). In other words, can we construct a class of matrices satisfying the given matrix equation.</p>
<p>Please help regarding this.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56511#post-id-56511I wanted to try at first with a 2 X 2 matrix to see what it gave, but I do not fully understand what is happening!
Why Maxima tell the equation is False, did I write something wrong ?
[test with 2 X 2 matrix on SageCell ](https://sagecell.sagemath.org/?q=ifmqfe)
it's painful not being allowed to write a code of about thirty lines in a comment.Mon, 05 Apr 2021 21:27:12 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56511#post-id-56511Comment by John Palmieri for <p><img src="/upfiles/16175450459866355.png" alt="image description"> </p>
<p>Here we know that $A=I_n$ satisfies the given matrix equation. But can we find other non trivial matrix ($\neq I_n$). In other words, can we construct a class of matrices satisfying the given matrix equation.</p>
<p>Please help regarding this.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56510#post-id-56510Yes, you're right, but the rest of my comment still applies. For example if $A^3=I$ and both $p$ and $q$ are divisible by 3. Or do you want to assume that $p$, $q$, and $r$ are relatively prime? In any case, if you imagine that $A$ has indeterminate entries and $p=5$, then you will have polynomial equations of degree 25. How would you hope to solve this?Mon, 05 Apr 2021 20:28:42 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56510#post-id-56510Comment by Kuldeep for <p><img src="/upfiles/16175450459866355.png" alt="image description"> </p>
<p>Here we know that $A=I_n$ satisfies the given matrix equation. But can we find other non trivial matrix ($\neq I_n$). In other words, can we construct a class of matrices satisfying the given matrix equation.</p>
<p>Please help regarding this.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56509#post-id-56509but p and q both can not be even since r is given to be odd and they form Pythagorean tripleMon, 05 Apr 2021 19:25:57 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56509#post-id-56509Comment by John Palmieri for <p><img src="/upfiles/16175450459866355.png" alt="image description"> </p>
<p>Here we know that $A=I_n$ satisfies the given matrix equation. But can we find other non trivial matrix ($\neq I_n$). In other words, can we construct a class of matrices satisfying the given matrix equation.</p>
<p>Please help regarding this.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56508#post-id-56508If $A$ satisfies $A^{p^2} = A^{q^2} = I_n$, then that works, e.g. if $A^2=I_n$ and $p$ and $q$ are both even. If you want Sage to solve the general problem, then you can write $A$ with all symbolic entries and try to solve the resulting $n^2$ Diophantine equations. If $n$, $p$, or $q$ are large, I think this will be very difficult. What values do you have in mind?Mon, 05 Apr 2021 19:06:59 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56508#post-id-56508Comment by John Palmieri for <p><img src="/upfiles/16175450459866355.png" alt="image description"> </p>
<p>Here we know that $A=I_n$ satisfies the given matrix equation. But can we find other non trivial matrix ($\neq I_n$). In other words, can we construct a class of matrices satisfying the given matrix equation.</p>
<p>Please help regarding this.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56497#post-id-56497How are graphs related to this matrix equation?Mon, 05 Apr 2021 02:34:58 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56497#post-id-56497Comment by Kuldeep for <p><img src="/upfiles/16175450459866355.png" alt="image description"> </p>
<p>Here we know that $A=I_n$ satisfies the given matrix equation. But can we find other non trivial matrix ($\neq I_n$). In other words, can we construct a class of matrices satisfying the given matrix equation.</p>
<p>Please help regarding this.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56495#post-id-56495Please help..here p,q,r,n are all given to us..Sun, 04 Apr 2021 22:59:58 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56495#post-id-56495Answer by Max Alekseyev for <p><img src="/upfiles/16175450459866355.png" alt="image description"> </p>
<p>Here we know that $A=I_n$ satisfies the given matrix equation. But can we find other non trivial matrix ($\neq I_n$). In other words, can we construct a class of matrices satisfying the given matrix equation.</p>
<p>Please help regarding this.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?answer=56521#post-id-56521The given matrix equation implies that the minimal polynomial of $A$ divides $f(x):=p^2 x^{p^2} - q^2 x^{q^2} - r^2$. It follows that $A$ can be constructed as a [block diagonal matrix](https://en.wikipedia.org/wiki/Block_matrix#Block_diagonal_matrices) $\begin{bmatrix} C_g & 0\\\\ 0 & I_{n-d} \end{bmatrix}$ for any monic divisor $g(x)\mid f(x)$ of degree $d:=\deg g(x)\leq n$, where $C_g$ is the [companion matrix](https://en.wikipedia.org/wiki/Companion_matrix) of $g(x)$.
Here is a sample code that constructs and prints such matrices:
def compA(n,p,q,r):
assert p^2 == q^2 + r^2
R.<x> = PolynomialRing(ZZ)
f = p^2*x^(p^2) - q^2*x^(q^2) - r^2
for g in divisors(f):
if g.degree()>n or not g.is_monic():
continue
A = block_diagonal_matrix(companion_matrix(g), identity_matrix(n-g.degree()))
print(A)
More generally, $A$ can be taken as a block diagonal matrix with blocks $C_{g_1}, \dots, C_{g_k}$, where each $g_i(x)$ is a monic divisor of $f(x)$, and $\sum_{i=1}^k \deg g_i(x) = n$. Matrices [similar](https://en.wikipedia.org/wiki/Matrix_similarity) to such $A$ will also satisfy the given matrix equation.Tue, 06 Apr 2021 21:33:33 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?answer=56521#post-id-56521Comment by Kuldeep for <p>The given matrix equation implies that the minimal polynomial of $A$ divides $f(x):=p^2 x^{p^2} - q^2 x^{q^2} - r^2$. It follows that $A$ can be constructed as a <a href="https://en.wikipedia.org/wiki/Block_matrix#Block_diagonal_matrices">block diagonal matrix</a> $\begin{bmatrix} C_g & 0\\ 0 & I_{n-d} \end{bmatrix}$ for any monic divisor $g(x)\mid f(x)$ of degree $d:=\deg g(x)\leq n$, where $C_g$ is the <a href="https://en.wikipedia.org/wiki/Companion_matrix">companion matrix</a> of $g(x)$.</p>
<p>Here is a sample code that constructs and prints such matrices:</p>
<pre><code>def compA(n,p,q,r):
assert p^2 == q^2 + r^2
R.<x> = PolynomialRing(ZZ)
f = p^2*x^(p^2) - q^2*x^(q^2) - r^2
for g in divisors(f):
if g.degree()>n or not g.is_monic():
continue
A = block_diagonal_matrix(companion_matrix(g), identity_matrix(n-g.degree()))
print(A)
</code></pre>
<p>More generally, $A$ can be taken as a block diagonal matrix with blocks $C_{g_1}, \dots, C_{g_k}$, where each $g_i(x)$ is a monic divisor of $f(x)$, and $\sum_{i=1}^k \deg g_i(x) = n$. Matrices <a href="https://en.wikipedia.org/wiki/Matrix_similarity">similar</a> to such $A$ will also satisfy the given matrix equation.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56536#post-id-56536Sorry, I was making a mistake.. It is now coming very nicely. Thank youWed, 07 Apr 2021 23:02:52 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56536#post-id-56536Comment by Max Alekseyev for <p>The given matrix equation implies that the minimal polynomial of $A$ divides $f(x):=p^2 x^{p^2} - q^2 x^{q^2} - r^2$. It follows that $A$ can be constructed as a <a href="https://en.wikipedia.org/wiki/Block_matrix#Block_diagonal_matrices">block diagonal matrix</a> $\begin{bmatrix} C_g & 0\\ 0 & I_{n-d} \end{bmatrix}$ for any monic divisor $g(x)\mid f(x)$ of degree $d:=\deg g(x)\leq n$, where $C_g$ is the <a href="https://en.wikipedia.org/wiki/Companion_matrix">companion matrix</a> of $g(x)$.</p>
<p>Here is a sample code that constructs and prints such matrices:</p>
<pre><code>def compA(n,p,q,r):
assert p^2 == q^2 + r^2
R.<x> = PolynomialRing(ZZ)
f = p^2*x^(p^2) - q^2*x^(q^2) - r^2
for g in divisors(f):
if g.degree()>n or not g.is_monic():
continue
A = block_diagonal_matrix(companion_matrix(g), identity_matrix(n-g.degree()))
print(A)
</code></pre>
<p>More generally, $A$ can be taken as a block diagonal matrix with blocks $C_{g_1}, \dots, C_{g_k}$, where each $g_i(x)$ is a monic divisor of $f(x)$, and $\sum_{i=1}^k \deg g_i(x) = n$. Matrices <a href="https://en.wikipedia.org/wiki/Matrix_similarity">similar</a> to such $A$ will also satisfy the given matrix equation.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56535#post-id-56535I'm not sure what error you're talking about. [Click here](https://sagecell.sagemath.org/?z=eJxNUNtqwzAMfe9X6K325hYaGGNjKeQPRh_LSPAS24glUmK7Jf372e3S7rwInSMdXTpjoeVhrASpUU3Ky_cVJOgQjI8w1gWUJUwpPIOvi6t22H7Meyjhk_sL8YC6PyA5cTzKq2yTlPqe5lqkIGGT23M23bLFxrIHB0jQ4RkD-yDs3_AMtOC2nXHeGCH3BKmYOCYOQzMwYSv-FWe0TBHpZO5klfb47rn9aTrUjkn3zaCjx1nkgzUh00I4qQA7kwziZeFo85gv5d119EhRVGr9ResHu7r98FXtXtSuUG_yF7MdYXw=&lang=sage&interacts=eJyLjgUAARUAuQ==) for an example computing `compA(7,15,12,9)` at SageCell.Wed, 07 Apr 2021 22:09:26 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56535#post-id-56535Comment by Kuldeep for <p>The given matrix equation implies that the minimal polynomial of $A$ divides $f(x):=p^2 x^{p^2} - q^2 x^{q^2} - r^2$. It follows that $A$ can be constructed as a <a href="https://en.wikipedia.org/wiki/Block_matrix#Block_diagonal_matrices">block diagonal matrix</a> $\begin{bmatrix} C_g & 0\\ 0 & I_{n-d} \end{bmatrix}$ for any monic divisor $g(x)\mid f(x)$ of degree $d:=\deg g(x)\leq n$, where $C_g$ is the <a href="https://en.wikipedia.org/wiki/Companion_matrix">companion matrix</a> of $g(x)$.</p>
<p>Here is a sample code that constructs and prints such matrices:</p>
<pre><code>def compA(n,p,q,r):
assert p^2 == q^2 + r^2
R.<x> = PolynomialRing(ZZ)
f = p^2*x^(p^2) - q^2*x^(q^2) - r^2
for g in divisors(f):
if g.degree()>n or not g.is_monic():
continue
A = block_diagonal_matrix(companion_matrix(g), identity_matrix(n-g.degree()))
print(A)
</code></pre>
<p>More generally, $A$ can be taken as a block diagonal matrix with blocks $C_{g_1}, \dots, C_{g_k}$, where each $g_i(x)$ is a monic divisor of $f(x)$, and $\sum_{i=1}^k \deg g_i(x) = n$. Matrices <a href="https://en.wikipedia.org/wiki/Matrix_similarity">similar</a> to such $A$ will also satisfy the given matrix equation.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56529#post-id-56529def compA(7,5,4,3):
assert 5^2 == 4^2 + 3^2
R.<x> = PolynomialRing(ZZ)
f = 5^2*x^(5^2) - 4^2*x^(4^2) - 3^2
for g in divisors(f):
if g.degree()>7:
continue
A = block_diagonal_matrix(companion_matrix(g), identity_matrix(7-g.degree()))
print(A)
Is it correct...but still the error message is comingWed, 07 Apr 2021 16:25:18 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56529#post-id-56529Comment by Max Alekseyev for <p>The given matrix equation implies that the minimal polynomial of $A$ divides $f(x):=p^2 x^{p^2} - q^2 x^{q^2} - r^2$. It follows that $A$ can be constructed as a <a href="https://en.wikipedia.org/wiki/Block_matrix#Block_diagonal_matrices">block diagonal matrix</a> $\begin{bmatrix} C_g & 0\\ 0 & I_{n-d} \end{bmatrix}$ for any monic divisor $g(x)\mid f(x)$ of degree $d:=\deg g(x)\leq n$, where $C_g$ is the <a href="https://en.wikipedia.org/wiki/Companion_matrix">companion matrix</a> of $g(x)$.</p>
<p>Here is a sample code that constructs and prints such matrices:</p>
<pre><code>def compA(n,p,q,r):
assert p^2 == q^2 + r^2
R.<x> = PolynomialRing(ZZ)
f = p^2*x^(p^2) - q^2*x^(q^2) - r^2
for g in divisors(f):
if g.degree()>n or not g.is_monic():
continue
A = block_diagonal_matrix(companion_matrix(g), identity_matrix(n-g.degree()))
print(A)
</code></pre>
<p>More generally, $A$ can be taken as a block diagonal matrix with blocks $C_{g_1}, \dots, C_{g_k}$, where each $g_i(x)$ is a monic divisor of $f(x)$, and $\sum_{i=1}^k \deg g_i(x) = n$. Matrices <a href="https://en.wikipedia.org/wiki/Matrix_similarity">similar</a> to such $A$ will also satisfy the given matrix equation.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56525#post-id-56525The code defines a function. To call it, one needs to provide values of `n`, `p`, `q`, `r`, like `compA(7,5,4,3)`.Wed, 07 Apr 2021 13:47:33 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56525#post-id-56525Comment by Kuldeep for <p>The given matrix equation implies that the minimal polynomial of $A$ divides $f(x):=p^2 x^{p^2} - q^2 x^{q^2} - r^2$. It follows that $A$ can be constructed as a <a href="https://en.wikipedia.org/wiki/Block_matrix#Block_diagonal_matrices">block diagonal matrix</a> $\begin{bmatrix} C_g & 0\\ 0 & I_{n-d} \end{bmatrix}$ for any monic divisor $g(x)\mid f(x)$ of degree $d:=\deg g(x)\leq n$, where $C_g$ is the <a href="https://en.wikipedia.org/wiki/Companion_matrix">companion matrix</a> of $g(x)$.</p>
<p>Here is a sample code that constructs and prints such matrices:</p>
<pre><code>def compA(n,p,q,r):
assert p^2 == q^2 + r^2
R.<x> = PolynomialRing(ZZ)
f = p^2*x^(p^2) - q^2*x^(q^2) - r^2
for g in divisors(f):
if g.degree()>n or not g.is_monic():
continue
A = block_diagonal_matrix(companion_matrix(g), identity_matrix(n-g.degree()))
print(A)
</code></pre>
<p>More generally, $A$ can be taken as a block diagonal matrix with blocks $C_{g_1}, \dots, C_{g_k}$, where each $g_i(x)$ is a monic divisor of $f(x)$, and $\sum_{i=1}^k \deg g_i(x) = n$. Matrices <a href="https://en.wikipedia.org/wiki/Matrix_similarity">similar</a> to such $A$ will also satisfy the given matrix equation.</p>
https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56523#post-id-56523Thank you for your answer. But there is no output of this programme when I compile it in SageWed, 07 Apr 2021 12:18:22 +0200https://ask.sagemath.org/question/56490/how-to-construct-a-class-of-matrices-satisfying-a-given-matrix-equation/?comment=56523#post-id-56523