diff --git a/functions.py b/functions.py
index 5d39d80f27d7d2bdf74ecd76be60564dade8858e..779ba14e67d0d8a64c55204c707a10c3cc0c044a 100644
--- a/functions.py
+++ b/functions.py
@@ -143,10 +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.dot(self.y.data.transpose())
-        #self.dy = grad.dot(self.x.data.transpose())
-        self.dx = grad * np.add(self.x.data, self.y.data.transpose())
-        self.dy = np.add(self.x.data.transpose(), self.y.data) * grad
+        self.dx = grad.dot(self.y.data.transpose())
+        self.dy = (self.x.data.transpose()).dot(grad)
         #######################################################################
         # --------------------------- END OF YOUR CODE ------------------------
         #######################################################################