The following two theorems give two algorithms for determining the copositivity of a given symmetric matrix of order 8 or 9. These two theorems can be proved by Lemma 1.1 and Lemma 1.2 following the same pattern as in [1]. 
Theorem 2.1.
Let
be symmetric and be partitioned as in (1.1) and
, then at least one of the following cases must happen:
-
(a)
If one
principal submatrix of
is not copositive, then
is not copositive. Otherwise it holds that
and
is copositive.
-
(b)
If
then
is copositive; if
with
and
is strictly copositive, then
is strictly copositive.
-
(c)
If
, then
is copositive if and only if
is copositive;
is strictly copositive if and only if
is strictly copositive and
and
is strictly copositive.
-
(d)
If
has exactly one negative entry:
, then
is copositive if and only if
is copositive;
is strictly copositive if and only if
is strictly copositive, and
and
is strictly copositive, where
(e) If
has exactly two negative entries:
, and
, then
is copositive if and only if
and
are all copositive;
is strictly copositive if and only if
are all strictly copositive and
and
is strictly copositive, where
(f) If
has exactly three negative entries:
and
, then
is copositive if and only if
are all copositive;
is strictly copositive if and only if
are all strictly copositive and
and
is strictly copositive, where
(g) If
has exactly four negative entries:
and
, then
is copositive if and only if
are all copositive;
is strictly copositive if and only if
are all strictly copositive and
and
is strictly copositive, where
(h) If
has exactly five negative entries:
and
, then
is copositive if and only if
are all copositive;
is strictly copositive if and only if
are all strictly copositive and
and
is strictly copositive, where
(i) If
has exactly six negative entries:
and
, then
is copositive if and only if
are all copositive;
is strictly copositive if and only if
are all strictly copositive and
and
is strictly copositive, where
It is clear (see [1, Remark
]) that if
is odd, then a copositive matrix
must have a row with an even number of negative entries. In other words, if a symmetric matrix of odd order has row with an even number of negative entries, then some
principal submatrices of it are not copositive. This fact will be used in Theorem 2.2. 
Theorem 2.2.
If
is symmetric, then at least one of the following cases must happen:
-
(a)
If one
principal submatrix of
is not copositive, then
is not copositive.
Otherwise (
must have a row with an even number of negative entries and
is copositive) find a row of
which has exactly
negative entries. If the
th row does, then interchange the
th row and column with the first row and column, and partition
into (1.1) as in Theorem 2.1.
-
(b)
If
, then
and
is copositive; if
with
and
is strictly copositive, then
is strictly copositive.
-
(c)
If
, then
, then
is copositive if and only if
is copositive;
is strictly copositive if and only if
is strictly copositive and
and
is strictly copositive.
-
(d)
If
, then
has exactly two negative entries:
, and
, then
is copositive if and only if
are all copositive;
is strictly copositive if and only if
are all strictly copositive and
and
is strictly copositive, where
(e) If
, then
has exactly four negative entries:
and
, then
is copositive if and only if
are all copositive;
is strictly copositive if and only if
are all strictly copositive and
and
is strictly copositive, where
(f) If
, then
has exactly six negative entries:
and
, then
is copositive if and only if
are all copositive;
is strictly copositive if and only if
are all strictly copositive and
and
is strictly copositive, where
As mentioned in [1], we have made six MATLAB functions: Cha3(
), Cha4(
), Cha5(
), Cha6(
), Cha7(
) and Cha(
), for determining the copositivity of symmetric matrices. Now we have made two more MATLAB functions of these type: Cha8(
) and Cha9(
) based on the two algorithms given by Theorems 2.1 and 2.2. The input of the functions is any
or
symmetric matrix
and there are four possible return values:
meaning "not copositive", "copositive (not strictly)" and "strictly copositive", "cannot determined," respectively. 
Main steps of Function 
(
) Find out if
has any
principal submatrix which is not copositive. If so, then return with "
" (Theorem 2.1(a)). Otherwise go to next step.
(
) Calculate the number
of the negative entries of the first row of
.
When
use Theorem 2.1(b) to determine copositivity of
and return.
When
use Theorem 2.1(c) to determine copositivity of
and return.
When
use Theorem 2.1(d) to determine copositivity of
and return.
When
use Theorem 2.1(e) to determine copositivity of
and return.
When
use Theorem 2.1(f) to determine copositivity of
and return.
When
use Theorem 2.1(g) to determine copositivity of
and return.
When
use Theorem 2.1(h) to determine copositivity of
and return.
When
use Theorem 2.1(i) to determine copositivity of
and return.
Main steps of Function 
(
) Find out if
has any
principal submatrix which is not copositive. If so, then return with "
" (Theorem 2.2(a)). Otherwise
must have some row containing exactly
negative entries and go to the next step.
(
) Find out if
has any row which has exactly
negative entries. If the
th row does, then interchange the
th row and column of
with the first row and column.
When
use Theorem 2.2(b) to determine copositivity of
and return.
When
use Theorem 2.2(c) to determine copositivity of
and return.
When
use Theorem 2.2(d) to determine copositivity of
and return.
When
use Theorem 2.2(e) to determine copositivity of
and return.
When
use Theorem 2.2(f) to determine copositivity of
and return.