diff --git a/sumpy/expansion/__init__.py b/sumpy/expansion/__init__.py
index d43379a6a3e7e0fefa8e6fac2b93b36a7dd9070e..f4144a861ca0393843e45dbfb4835e2cf466a5a9 100644
--- a/sumpy/expansion/__init__.py
+++ b/sumpy/expansion/__init__.py
@@ -420,7 +420,7 @@ class NewLinearRecurrenceBasedDerivativeWrangler \
         for i in range(s.shape[0]):
             for j in range(s.shape[1]):
                 if np.abs(s[i][j]) > tol:
-                    coeff_matrix[i].append((j, s[i][j]))
+                    coeff_matrix[j].append((i, s[i][j]))
 
         logger.debug("computing recurrence for Taylor coefficients: "
                      "done after {dur:.2f} seconds"