diff --git a/functions.py b/functions.py
index cb80c1a0efcb486f7eb32afc6ed0d63369a2eafd..0e2cec2ac11bc15bbc00333037891ce68ffc3d2f 100644
--- a/functions.py
+++ b/functions.py
@@ -143,8 +143,8 @@ class MatMul(_Function):
         # TODO: Implement the derivative dx for this opetation and add the
         # result of the chain rule on self.dx.
         #######################################################################
-        self.dx = grad * np.add(self.x.data, self.y.data.transpose())
-        self.dy = grad * np.add(self.x.data.transpose(), self.y.data)
+        self.dx = grad * np.add(self.x.data.transpose(), self.y.data)
+        self.dy = grad * np.add(self.x.data, self.y.data.transpose())
         #######################################################################
         # --------------------------- END OF YOUR CODE ------------------------
         #######################################################################