#Import the NumPy library
import numpy as np
# create two matrices
A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])
# take the dot product of the two matrices
C = np.dot(A, B)
# extract the diagonal elements of C using indexing
diagonal = C[range(C.shape[0]), range(C.shape[0])]
# print results
print(diagonal)