% vecsum
x = [1;1/3];
y = [1/4; 5/4];
z = x + y;
plot([0 x(1)],[0 x(2)],'k','linewidth',2)
hold on
plot([0 y(1)],[0 y(2)],'k','linewidth',2)
plot([y(1) z(1)],[y(2) z(2)],'k','linewidth',2)
plot([x(1) z(1)],[x(2) z(2)],'k','linewidth',2)

text(-.05,-.05,'(0,0)','fontsize',14)
text(x(1)+.05,x(2),'(a,b)','fontsize',14)
text(y(1)-.2,y(2),'(c,d)','fontsize',14)
text(z(1)+.05,z(2),'(a+c,b+d)','fontsize',14)
text(1/16,3/2,'(A)','fontsize',20)
axis equal
axis off
hold off

% now play with [2 -1;-1 2]
figure(2)
plot([0 1 1 0 0],[0 0 1 1 0],'k','linewidth',2)
hold on
A = [2 -1;-1 2];
x = A*[1;0];
y = A*[0;1];
z = [1;1];
plot([0 x(1)],[0 x(2)],'r','linewidth',2)
plot([0 y(1)],[0 y(2)],'r','linewidth',2)
plot([y(1) z(1)],[y(2) z(2)],'r','linewidth',2)
plot([x(1) z(1)],[x(2) z(2)],'r','linewidth',2)
axis equal
text(1.5,1.5,'(B)','fontsize',20)
%axis off
grid
axis tight
hold off
