From the documentation:

The @ (at) operator is intended to be used for matrix multiplication. No builtin Python types implement this operator.

The @ operator was introduced in Python 3.5. @= is matrix multiplication followed by assignment, as you would expect. They map to __matmul__, __rmatmul__ or __imatmul__ similar to how + and += map to __add__, __radd__ or __iadd__.

The operator and the rationale behind it are discussed in detail in PEP 465.

Answer from user1804599 on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › what-is-the-symbol-in-python
What Is the @ Symbol in Python? - GeeksforGeeks
July 23, 2025 - The two matrices, matrix_a and matrix_b, are defined as NumPy array. The "@" operator, introduced for matrix multiplication in Python, that utilize to calculate the matrix product of matrix_a and matrix_b.
Top answer
1 of 4
276

From the documentation:

The @ (at) operator is intended to be used for matrix multiplication. No builtin Python types implement this operator.

The @ operator was introduced in Python 3.5. @= is matrix multiplication followed by assignment, as you would expect. They map to __matmul__, __rmatmul__ or __imatmul__ similar to how + and += map to __add__, __radd__ or __iadd__.

The operator and the rationale behind it are discussed in detail in PEP 465.

2 of 4
131

@= and @ are new operators introduced in Python 3.5 performing matrix multiplication. They are meant to clarify the confusion which existed so far with the operator * which was used either for element-wise multiplication or matrix multiplication depending on the convention employed in that particular library/code. As a result, in the future, the operator * is meant to be used for element-wise multiplication only.

As explained in PEP0465, two operators were introduced:

  • A new binary operator A @ B, used similarly as A * B
  • An in-place version A @= B, used similarly as A *= B

Matrix Multiplication vs Element-wise Multiplication

To quickly highlight the difference, for two matrices:

A = [[1, 2],    B = [[11, 12],
     [3, 4]]         [13, 14]]
  • Element-wise multiplication will yield:

    A * B = [[1 * 11,   2 * 12], 
             [3 * 13,   4 * 14]]
    
  • Matrix multiplication will yield:

    A @ B  =  [[1 * 11 + 2 * 13,   1 * 12 + 2 * 14],
               [3 * 11 + 4 * 13,   3 * 12 + 4 * 14]]
    

Usage in Numpy

So far, Numpy used the following convention:

  • the * operator (and arithmetic operators in general) were defined as element-wise operations on ndarrays and as matrix-multiplication on numpy.matrix type.

  • method/function dot was used for matrix multiplication of ndarrays

Introduction of the @ operator makes the code involving matrix multiplications much easier to read. PEP0465 gives us an example:

# Current implementation of matrix multiplications using dot function
S = np.dot((np.dot(H, beta) - r).T,
            np.dot(inv(np.dot(np.dot(H, V), H.T)), np.dot(H, beta) - r))

# Current implementation of matrix multiplications using dot method
S = (H.dot(beta) - r).T.dot(inv(H.dot(V).dot(H.T))).dot(H.dot(beta) - r)

# Using the @ operator instead
S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)

Clearly, the last implementation is much easier to read and interpret as an equation.

Discussions

What does the "@" operator do in Python?
Matrix multiplication. More on reddit.com
🌐 r/learnpython
5
4
June 7, 2021
python - What does the @-operator do? - Blender Stack Exchange
I've been trying to figure out what the @ in the following code does: T_world2bcam = -1*R_world2bcam @ cam.location where R_world2bcam is a 3x3 Matrix and cam.location is a Vector. The code is fro... More on blender.stackexchange.com
🌐 blender.stackexchange.com
February 28, 2022
syntax - What does the "at" (@) symbol do in Python? - Stack Overflow
In the context of matrix multiplication, a @ b invokes a.__matmul__(b) - making this syntax: ... I also do not know what to search for as searching Python docs or Google does not return relevant results when the @ symbol is included. More on stackoverflow.com
🌐 stackoverflow.com
April 6, 2013
numpy - What's the difference between @ and * with python matrix multiplication? - Stack Overflow
If you haven't specified that a is a matrix and have used an array instead, a * a would return every element in a squared. ... Sign up to request clarification or add additional context in comments. ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... 2 What is the difference between operators "numpy.dot()", " * " and "@" when working on numpy arrays? 1 How do you multiply a column vector with a row vector using @ in Python... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Built In
builtin.com › software-engineering-perspectives › python-symbol
What Is the @ Symbol in Python? | Built In
The @ symbol in Python is used to apply a decorator to a function or method to extend its functionality, or to help perform matrix multiplication.
🌐
Python
peps.python.org › pep-0465
PEP 465 – A dedicated infix operator for matrix multiplication | peps.python.org
February 20, 2014 - This PEP proposes a new binary operator to be used for matrix multiplication, called @. (Mnemonic: @ is * for mATrices.) A new binary operator is added to the Python language, together with the corresponding in-place version:
🌐
Alysivji
alysivji.com › python-matrix-multiplication-operator.html
@ Python's Matrix Multiplication Operator - Siv Scripts
There are many factors that play into this: Python's simple syntax, the fantastic PyData ecosystem, and of course buy-in from Python's BDFL. PEP 465 introduced the @ infix operator that is designated to be used for matrix multiplication.
Find elsewhere
🌐
NAO IT Systems LLC.
digibeatrix.com › home › functions & classes › understanding python’s @: decorators, matrix ops, pandas
Understanding Python's @: decorators, matrix ops, pandas - Practical Python Programming
November 29, 2025 - Learn how Python's @ symbol powers decorators, matrix multiplication, and pandas query(). This guide offers clear explanations and beginner-friendly code examples.
🌐
Medium
swainshashwat.medium.com › numpy-operator-a-unique-way-to-cross-product-matrices-in-python-b19c9ee886a8
Numpy “@” operator: A unique way to cross product matrices in Python | by Shashwat Sourav Swain | Medium
May 13, 2023 - Numpy “@” operator: A unique way to cross product matrices in Python The @ and @= were introduced in python 3.5 and explicitly used for matrix cross-product multiplication. The introduction of …
🌐
Finxter
blog.finxter.com › home › learn python blog › numpy matrix multiplication — np.matmul() and @ [ultimate guide]
NumPy Matrix Multiplication - np.matmul() and @ [Ultimate Guide] - Be on the Right Side of Change
November 11, 2023 - Watch the video where I go over the article in detail: To perform matrix multiplication between 2 NumPy arrays, there are three methods. All of them have simple syntax. Let’s quickly go through them the order of best to worst. First, we have the @ operator · # Python >= 3.5 # 2x2 arrays where each value is 1.0 >>> A = np.ones((2, 2)) >>> B = np.ones((2, 2)) >>> A @ B array([[2., 2.], [2., 2.]])
🌐
Medium
medium.com › analytics-vidhya › python-matrix-multiplication-using-a-dedicated-infix-operator-b0a41b68904f
Python Matrix Multiplication using a Dedicated Infix Operator @
March 15, 2024 - A new binary operator to be used for matrix multiplication, called @. It makes matrix formulas dramatically easier to work with for both…
🌐
AskPython
askpython.com › home › what does the “at” (@) symbol do in python?
What does the "at" (@) symbol do in Python? - AskPython
February 27, 2023 - In Python 3.5, the @ operator can be overloaded. It is termed __matmul__ since it is intended to perform matrix multiplication.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.matmul.html
numpy.matmul — NumPy v2.1 Manual
The matmul function implements the semantics of the @ operator introduced in Python 3.5 following PEP 465.
🌐
Quora
quora.com › What-does-the-sign-mean-in-Python
What does the '@' sign mean in Python? - Quora
An ‘@’ symbol at the beginning of a line is used for class, function and method decorators. Most common - @property @classmethod @staticmethod · Also ‘@’ is generally used for matrix multiplication(Python 3.5 and above)
🌐
Codesolid
codesolid.com › python-matrix-multiplication
Python Matrix Multiplication: NumPy, SymPy, and the Math Behind It — CodeSolid.com 0.1 documentation
The @ operator is now so widely supported in Python libraries that we can say the answer to “How do I do matrix multiplication in Python” has a definitive answer: “Use the @ operator.” In addition to NumPy and SymPy, for example, TensorFlow also implements this operator.
🌐
Delft Stack
delftstack.com › home › howto › python › symbol in python
The @ Symbol in Python | Delft Stack
February 2, 2024 - Some commonly used decorators in Python are @property, @classmethod, and @staticmethod. From Python 3.5, the @ symbol can also be used as an operator to perform matrix multiplication in Python.