How to find the components of matrix on GAP with given conditions

71 Views Asked by At

Let be given the matrix $$ A= \begin{pmatrix} a & -u & -p \\ -b & v & -q \\ -c & -w & r \\ \end{pmatrix} $$ Find all possible positive integers $a,u,p,b,v,q,c,w,r$ such that

$$24>a>b,c>0,$$

$$13>v>u,w>0 ,$$

$$16>r>p,q>0 $$

and such that the determinant of matrix is divisible by 25.

I started on this way but since begining

gap> for a in $[b+1..23]$ do

> for $b$ in $[0..a-1]$ do

> for $c$ in $[0.. a-1]$ do

> for $r$ in $[p+1..15]$ do

> for $p$ in $[0..r-1]$ do

> for $q$ in $[0..r-1]$ do
.
.
> mt:$=[[a,-u,-p],[-b,v,-q],[-c,-w,r]]$;

got Error, Variable: '$b$' must have an assigned value in.

1

There are 1 best solutions below

1
On

First, a few remarks: what family do your variables belong to? Are they integers, rational numbers, etc? For now I'll assume they are integers.

This is more of a programming problem than a mathematical problem, but here goes. There are a few problems with your code:

for a in [b+1..23] do
    for b in [0..a−1] do
        for c in [0..c−1] do
  1. In the first line, you define a as a variable taking on values between b+1 and 23, but you haven't defined b yet: you do that the very next line. So of course GAP will complain that b is not defined yet.

  2. In the same piece of code, you also have a circular reasoning: the possible values of a depend on the value of b, but the possible values of b depend on the value of a.

  3. c will lie in the interval [0..c-1]? You're again trying to define a variable using a variable that is not yet defined, but this time they are the same variable. This makes no sense.

  4. b and c should be strictly greater than $0$ but the intervals include $0$.

Instead, you should pick one variable to be independent of the others. Ignoring what $b$ and $c$ are, you know that $24 > a > 0$. Then, for each value of $a$, determine what the possible values of $b$ and $c$ are. Your code could, for example, look like this:

for a in [1..23] do
    for b in [1..a-1] do
        for c in [1..a-1] do
            ...
        od;
    od;
od;