# Given any metric, how to find the straight line path between two points? [closed]

Say we are given a two-dimensional metric $$ds^2=f_1(x)dx^2+f_2(x)dy^2,$$ for any kind of function. How do we calculate the distance along a straight line path (not the shortest possibly) between, say, points $(0,10)$ and $(1,15)$? How do we find the equation for the trajectory?

## closed as off-topic by ACuriousMind♦, Kyle Kanos, Brandon Enright, JamalS, NeuneckFeb 18 '15 at 7:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Homework-like questions should ask about a specific physics concept and show some effort to work through the problem. We want our questions to be useful to the broader community, and to future users. See our meta site for more guidance on how to edit your question to make it better" – ACuriousMind, Brandon Enright, JamalS, Neuneck
If this question can be reworded to fit the rules in the help center, please edit the question.

• Would Mathematics be a better home for this question? – Qmechanic Feb 17 '15 at 20:02

If by "straight line" you mean "linearly varying the coordinates from the beginning point $(x_0,y_0)$ to the endpoint $(x_1,y_1)$," then the trajectory is just that. You can parametrize it as $(x,y) = (1-\lambda) (x_0,y_0) + \lambda (x_1,y_1)$ for $\lambda$ running from $0$ to $1$. Call this path $C$. The distance is $$\int\limits_C \sqrt{ds^2} = \int_0^1 \sqrt{f_1 \cdot \left(\frac{\mathrm{d}x}{\mathrm{d}\lambda}\right)^2 + f_2 \cdot \left(\frac{\mathrm{d}y}{\mathrm{d}\lambda}\right)^2}\ \mathrm{d}\lambda.$$