For example, if I give the coordinates of two vectors a and B, how can I find a · B? Can I directly multiply them by coordinates?

For example, if I give the coordinates of two vectors a and B, how can I find a · B? Can I directly multiply them by coordinates?

Let a be (x1, Y1) and B be (X2, Y2);
a·b = x1*x2 + y1*y2;