
A skew-symmetric matrix (also known as an anti-symmetric matrix) is a square matrix that is equal to the negative of its transpose. This means that when its rows are swapped with its columns and all signs are flipped, the matrix remains unchanged.
Consider a matrix where a diagonal line running from the top left to the bottom right divides the matrix. Each entry on one side of this line is the negative reflection of the corresponding entry on the other side. For example, if one element above the diagonal is ‘a’, then the element symmetrically opposite below the diagonal would be ‘-a’. This property characterizes the skew-symmetry of a matrix around its diagonal.

Moreover, an essential feature of skew-symmetric matrices is that all diagonal elements must be zero, because each element is equal to its own negative, which is only possible if it is zero.
Checking Matrix Skew-Symmetry in Python
Before checking if a matrix is skew-symmetric, it is essential to confirm that the matrix is square. A square matrix has an equal number of rows and columns, a necessary condition for skew-symmetry since the concept of “mirroring” across the diagonal only makes sense when the matrix has the same dimensions in both directions. To learn more about square matrices, refer to our post on: How to Create Square and Rectangle Matrices in Python.
To validate the skew-symmetry of matrices computationally, we’ll employ Python’s NumPy library, specifically using the .T attribute for transposing the matrix and the np.array_equal() functions. Let’s take a look at few examples.
1. Skew-Symmetric Matrix Example:
import numpy as np
# Define a skew-symmetric matrix
matrix = np.array([
[0, 2, -1],
[-2, 0, 3],
[1, -3, 0]
])
# Compute its transpose
transpose = matrix.T
# Compute the negative of the original matrix
negative_matrix = -matrix
# Check if the matrix is skew-symmetric
is_skew_symmetric = np.array_equal(transpose, negative_matrix)
print("Original Matrix:\n", matrix)
print("Transpose of the Matrix:\n", transpose)
print("Negative of the Original Matrix:\n", negative_matrix)
print("Is the matrix skew-symmetric?:", is_skew_symmetric)
Output:
Original Matrix: [[ 0 2 -1] [-2 0 3] [ 1 -3 0]] Transpose of the Matrix: [[ 0 -2 1] [ 2 0 -3] [-1 3 0]] Negative of the Original Matrix: [[ 0 -2 1] [ 2 0 -3] [-1 3 0]] Is the matrix skew-symmetric?: True
2. Non-Skew-Symmetric Matrix Example:
import numpy as np
# Define a non-skew-symmetric matrix
matrix = np.array([
[0, 4, -1],
[-3, 0, 2],
[1, -6, 0]
])
# Compute its transpose
transpose = matrix.T
# Compute the negative of the original matrix
negative_matrix = -matrix
# Check if the matrix is skew-symmetric
is_skew_symmetric = np.array_equal(transpose, negative_matrix)
print("Original Matrix:\n", matrix)
print("Transpose of the Matrix:\n", transpose)
print("Negative of the Original Matrix:\n", negative_matrix)
print("Is the matrix skew-symmetric?:", is_skew_symmetric)
Output:
Original Matrix: [[ 0 4 -1] [-3 0 2] [ 1 -6 0]] Transpose of the Matrix: [[ 0 -3 1] [ 4 0 -6] [-1 2 0]] Negative of the Original Matrix: [[ 0 -4 1] [ 3 0 -2] [-1 6 0]] Is the matrix skew-symmetric?: False
The exploration of skew-symmetric matrices in this post highlights their unique characteristics and the mathematical conditions they must satisfy. The examples demonstrate how to check the skew-symmetry of a matrix in Python. The .T attribute provides a convenient and quick way to transpose a matrix and verify if it is skew-symmetric by comparing it to its negative form.
