A3_np = np.array([[1, 2], [3, 2]], dtype=float)
v1 = np.array([2, 3], dtype=float)
v2 = np.array([-1, 1], dtype=float)
v1n = v1 / np.linalg.norm(v1)
v2n = v2 / np.linalg.norm(v2)
fig, ax = plt.subplots(figsize=(6, 6))
ax.axhline(0, color='gray', lw=0.7)
ax.axvline(0, color='gray', lw=0.7)
# Eigenvectors
ax.quiver(0, 0, v1[0], v1[1], angles='xy', scale_units='xy', scale=1,
color='steelblue', width=0.012, label=r'$\mathbf{v}_1=(2,3)^T,\;\lambda_1=4$')
ax.quiver(0, 0, v2[0], v2[1], angles='xy', scale_units='xy', scale=1,
color='tomato', width=0.012, label=r'$\mathbf{v}_2=(-1,1)^T,\;\lambda_2=-1$')
# A*v1 and A*v2 (should be lambda*v)
Av1 = A3_np @ v1 # = 4*v1
Av2 = A3_np @ v2 # = -1*v2
ax.quiver(0, 0, Av1[0], Av1[1], angles='xy', scale_units='xy', scale=1,
color='steelblue', alpha=0.35, width=0.012, linestyle='dashed')
ax.quiver(0, 0, Av2[0], Av2[1], angles='xy', scale_units='xy', scale=1,
color='tomato', alpha=0.35, width=0.012, linestyle='dashed')
# Annotations
ax.annotate(r'$\mathbf{v}_1$', xy=v1, xytext=(2.2, 2.7), fontsize=12,
color='steelblue')
ax.annotate(r'$A\mathbf{v}_1 = 4\mathbf{v}_1$', xy=Av1,
xytext=(8.2, 11.5), fontsize=10, color='steelblue', alpha=0.7)
ax.annotate(r'$\mathbf{v}_2$', xy=v2, xytext=(-1.4, 1.1), fontsize=12,
color='tomato')
ax.annotate(r'$A\mathbf{v}_2 = -\mathbf{v}_2$', xy=Av2,
xytext=(0.8, -1.4), fontsize=10, color='tomato', alpha=0.7)
ax.set_xlim(-3, 12)
ax.set_ylim(-3, 13)
ax.set_aspect('equal')
ax.set_xlabel(r'$v_1$', fontsize=13)
ax.set_ylabel(r'$v_2$', fontsize=13)
ax.set_title(r'Eigenvectors of $A$ (entries: row 1 = [1, 2], row 2 = [3, 2])',
fontsize=12)
ax.legend(fontsize=10, loc='upper left')
plt.tight_layout()
plt.show()