using
System;
class
GFG {
static
int
N = 3;
static
void
multiply(
int
[,]mat,
int
[,]res)
{
for
(
int
i = 0; i < N; i++) {
for
(
int
j = 0; j < N; j++) {
res[i,j] = 0;
for
(
int
k = 0; k < N; k++)
res[i,j] += mat[i,k] * mat[k,j];
}
}
}
static
bool
InvolutoryMatrix(
int
[,]mat)
{
int
[,]res =
new
int
[N,N];
multiply(mat, res);
for
(
int
i = 0; i < N; i++) {
for
(
int
j = 0; j < N; j++) {
if
(i == j && res[i,j] != 1)
return
false
;
if
(i != j && res[i,j] != 0)
return
false
;
}
}
return
true
;
}
public
static
void
Main ()
{
int
[,]mat = { { 1, 0, 0 },
{ 0, -1, 0 },
{ 0, 0, -1 } };
if
(InvolutoryMatrix(mat))
Console.WriteLine(
"Involutory Matrix"
);
else
Console.WriteLine(
"Not Involutory Matrix"
);
}
}