Mathematical Analysis of Line Intersection and Shortest Distance Algorithms

The time of arrival (TOA) trilateration is one of the representative location detection tech-nologies (LDT) that determines the true location of a mobile station (MS) using a unique intersection point of three circles based on three radii corresponding to distances between MS and base stations (BSs) and center coordinates of BSs. Since the distance between MS and BS is estimated by using the number of time delays, three circles based on the estimated radii are generally increased and they may not meet at a single point, resulting in the location estimation error. In order to compensate this estimation error and to improve estimation performance, we present two advanced TOA trilateration localization algorithms with detail mathematical expressions. The considered algorithms are the shortest distance algorithm, which calculates an average of three interior intersection points among an entire six intersection points from three intersecting circles, and the line intersection algorithm, which calculates an intersection point of three lines connecting two intersection points of two circles among the three circles, as the estimated location of the MS. In this paper, we present both algorithms with detailed mathematical expressions. The computer simulation results are provided to compare the location estimation performance of both algorithms. In addition, in this paper, mathematical analysis is provided to indicate the relation between the line intersection algorithm and the shortest distance algorithm. In this analysis, we verify that line equations based on the intersection points obtained from the shortest distance algorithm are identical to those obtained from the line intersection algorithm.


Introduction
The location detection technique of mobile stations (MSs) is of great importance in the development of the modern wireless cellular communication system. The information available about the MS location is used in various vital fields from the security level to the entertainment level, which is increasingly challenging. Many researchers around the world are working on achieving MS location accuracy at low cost, with precision, reliability, and reusability in its components [1,2].
In the wireless communication system, the accurate location detection of the MS has gained considerable interest, particularly since the U.S. Federal Communications Commission (FCC) made the rule to cellular providers to generate precise locations of the MS for enhanced 911 (E-911) services. The mandated rule specified that for a minimum of 95% performance in general cases, but it may have a high estimation error in the extreme cases because it does not consider the increasing factor for each circle. In order to improve the estimation performance for the MS location, the line intersection algorithm, which considers the increasing factor of the calculated circles, has been proposed in [27]. In this algorithm, there are six intersection points; these are based on three circles and three lines connecting two intersection points corresponding to a specific two circles among the entire three circles. It calculates the intersection point of these three lines and determines the location of the MS from the calculated line intersection point. This algorithm is more efficient and has better performance for the MS location compared to the shortest distance algorithm; this is because it does not need to select three interior intersection points among six intersection points and considers the increasing factor of the calculated circles. In this paper, both algorithms are minutely described using detailed equations for the mathematical analysis.
The purpose of this paper is to present enhanced TOA trilateration algorithms with detailed mathematical analysis in order to improve the location estimation performance. The line intersection algorithm must assume that three intersection lines meet at a single point. However, this assumption is not required, because it is easily verified that three lines always intersect at a single point for the accurate location estimation of the MS, as shown in this paper. Each line is usually formed by connecting each two intersection points of a specific two circles among three circles based on three BSs, and we determine this line intersection point as the location of the MS. In addition, we provide the mathematical approach to present the relation between the shortest distance and the line intersection algorithms in this paper. This analysis shows that line equations based on intersection points obtained from the shortest distance algorithm are identical to line equations obtained from the line intersection algorithm.

Issues for TOA Trilateration Method
The mobile location has received considerable attention over the past few years and a number of technological methods for determining the MS location have been studied and developed. The TOA trilateration technique is based on the measurement of distances between at least three BSs and MS [28][29][30][31][32][33][34][35]. It determines the MS position by calculating the intersection of three circles with radii corresponding to distances between MS and BSs and centers corresponding to the coordinates of BSs. The TOA technique, which is widely applied to various wireless positioning localization systems [36][37][38][39][40][41], utilizes the signal propagation time to determine the distance between BS and MS [42][43][44].
For the TOA trilateration approach, the MS location is determined by solving at least three quadratic equations based on circles with radii corresponding to distances between MS and BSs and centers corresponding to coordinate of BSs [14,19]. In this approach, the true distance between MS and ith BS, d i , is given by where (x, y) is the true coordinate of the MS, and (x i , y i ) is the coordinate of ith BS. The distances between MS and BS1, BS2, and BS3 are defined as d 1 , d 2 , and d 3 , respectively, as shown in Figure 1, which presents the TOA trilateration algorithm.
In the TOA trilateration technique, the distance between MS and BS is same as the signal propagation multiplied by the speed of light [23,44]. Since TOA estimates the distance between MS and BS by counting the number of time delays, the estimated distance between MS and BS is generally increased from the original distance [27]. The number of delay samples in the particular sampling rate, N i , is given by where c is the velocity of light, F is the particular sampling rate, and "ceil" is the round up function employed in order to make the right hand side in (2) to the integer number, which This estimated distance in (3) is generally longer than the original distance, due to the round up processing presented in (2).
Due to the increased distances, each radius has been expanded and three circles do not intersect at a single point. In general, there are six intersection points of three intersecting circles based on the estimated distances, as shown in Figure 2. This unmatched intersection point may cause the location estimation error to find an exact location. In order to solve this problem, the shortest distance algorithm and the line intersection algorithm, described in the next section, have been proposed.
up function employed in order to make the right hand side in (2) to which results in the expansion of the radius. The estimated distance b BS, i ed , is calculated This estimated distance in (3) is generally longer than the origi the round up processing presented in (2).
Due to the increased distances, each radius has been expanded not intersect at a single point. In general, there are six intersection p secting circles based on the estimated distances, as shown in Figure  intersection point may cause the location estimation error to find an der to solve this problem, the shortest distance algorithm and the lin rithm, described in the next section, have been proposed.

Enhanced TOA Trilateration Algorithms
In this section, we mathematically present the shortest distanc where c is the velocity of light, F is the particular sampling rate, and "ceil" is t up function employed in order to make the right hand side in (2) to the integer which results in the expansion of the radius. The estimated distance between MS BS, i ed , is calculated This estimated distance in (3) is generally longer than the original distanc the round up processing presented in (2).
Due to the increased distances, each radius has been expanded and three c not intersect at a single point. In general, there are six intersection points of th secting circles based on the estimated distances, as shown in Figure 2. This un intersection point may cause the location estimation error to find an exact locati der to solve this problem, the shortest distance algorithm and the line intersect rithm, described in the next section, have been proposed.

Enhanced TOA Trilateration Algorithms
In this section, we mathematically present the shortest distance algorithm line intersection algorithm to solve the problem for the MS location estimation

Enhanced TOA Trilateration Algorithms
In this section, we mathematically present the shortest distance algorithm and the line intersection algorithm to solve the problem for the MS location estimation that was caused by the unmatched intersection points of three circles based on the estimated distances between MS and BSs, described in the previous section. These two algorithms enhance the performance of the MS location of the TOA trilateration.

Shortest Distance Algorithm
In this subsection, the shortest distance algorithm for solving the problem caused by the unmatched intersection points of the estimated three circles is presented in detailed mathematical expressions. Since the estimated distances between MS and BSs are generally increased from the original distances, three circles based on the estimated distances may not intersect at a single point and there are six intersection points of them. The shortest distance algorithm selects the three closest interior intersection points of the entire six intersection points of three circles and determines the location of the MS to the average coordinate of the selected three intersection points, as shown in Figure 3. First of all, we find two intersection points of two circles, assuming that the estimated distance between MS and BS1, ed 1 , is shorter than the estimated distance between MS and BS2, ed 2 . In this case, the distance from the center coordinate BS1 to the line-joining point of the intersection is given by [45] where In (5), the values of δx and δy are the differences between coordinates of two BSs, defined as ∆x and ∆y y 2 − y 1 .
Utilizing (4) and (5), we find two coordinates of circle intersection points given by and Using a similar procedure, four other coordinates of the intersection points corresponding to (BS2, BS3) and (BS3, BS1) can be obtained. After finding all six intersection points using the above procedure, we select three points with the shortest distance between the coordinates of three BSs and intersection points. As an example, three interior intersection points (I, J, K) are shown in Figure 3. The first process in selecting the interior intersection points is to compare distances between a coordinate of BS3 and two intersection points (I and I ) of circles based on BS1 and BS2. In this example, we choose an interior intersection coordinate (I) corresponding to the shorter distance between two distances. The same process is repeated for determining two other interior intersection coordinates (J Energies 2021, 14, 1492 6 of 17 and K). Finally, we calculate an average of the selected three intersection coordinates for determining the MS location coordinate, (x,ŷ), given bŷ The shortest distance algorithm for determining the MS location is summarized in Table 1, and Figure 4 shows the flow chart for it.
Although the shortest distance algorithm has a generally good performance, it may have a serious location estimation error in extreme cases because it does not consider the increasing factor of the estimated circles.
intersection points (I, J, K) are shown in Figure 3. The first process in selecting the interior intersection points is to compare distances between a coordinate of BS3 and two intersection points (I and I') of circles based on BS1 and BS2. In this example, we choose an interior intersection coordinate (I) corresponding to the shorter distance between two distances. The same process is repeated for determining two other interior intersection coordinates (J and K). Finally, we calculate an average of the selected three intersection coordinates for determining the MS location coordinate,  , xy, given by (12) and The shortest distance algorithm for determining the MS location is summarized in Table 1, and Figure 4 shows the flow chart for it.
Although the shortest distance algorithm has a generally good performance, it may have a serious location estimation error in extreme cases because it does not consider the increasing factor of the estimated circles.   1. Initialize the circles c1, c2, and c3 of BSs with radii corresponding to the estimated distances ed 1 , ed 2 , and ed 3 . The three estimated distances between BSs and MS are calculated by Find all six intersection coordinate points (I, I , J, J , K, and K ) formed by three circles of BS. 3. Calculate the distances between the center of the circle, c1 (x 1 , y 1 ), and each intersection point x j , y j formed by other circles of BSs (c2 and c3): 4. Select the intersection point corresponding to the shorter distance from step 3. 5. Repeat step 3 and 4 for the center of circles, c2 and c3. 6. Decide the position of the MS by taking the average of the selected three points.
Energies 2021, 14, 1492 4. Select the intersection point corresponding to the shorter distance from step 3. 5. Repeat step 3 and 4 for the center of circles, c2 and c3. 6. Decide the position of the MS by taking the average of the selected three points. 7.

Line Intersection Algorithm
The shortest distance algorithm determines the location of the MS to an average of the selected three intersection points of the entire six intersection points without considering the increased factor of each estimated circle. In general, it has good performance for estimating the MS location, but it sometimes has a high location estimation error in extreme cases due to it not considering the increasing factor of the extended circles. In order to overcome this problem, the line intersection algorithm, which considers the increasing factor of them and does not require the selection of three interior intersection points, is mathematically presented in this subsection. This algorithm determines the intersection point of three lines connecting two intersection points of a specific two circles of the entire three circles as the location of the MS shown in Figure 5. Three circle equations corresponding to each BS are written as where α i = −2x i , β i = −2y i , and γ i = x 2 i + y 2 i − ed 2 i . These three circle equations are applied to obtain three lines of intersection equations, as given by where (17)- (19) are intersection line equations of two circles based on BS1 and BS2, BS2 and BS3, and BS3 and BS1, respectively. Finally, we determine the MS location by solving two equations among three intersection line equations. Considering (17) and (18), two equations form a matrix to get a solution, yielding and the estimated location of the MS, (x,ŷ), is given bŷ Energies 2021, 14, x FOR PEER REVIEW 9 of 19 Figure 5. Line intersection algorithm. Table 2 summarizes the line intersection algorithm for determining the MS location. This algorithm is more efficient and has better performance compared to the shortest distance algorithm, because it does not require the selection of three interior intersection points among the entire six intersection points and considers the increasing factor of the extended circle. Determine the location of the MS,  , x Figure 5. Line intersection algorithm. Table 2 summarizes the line intersection algorithm for determining the MS location. This algorithm is more efficient and has better performance compared to the shortest distance algorithm, because it does not require the selection of three interior intersection points among the entire six intersection points and considers the increasing factor of the extended circle.  1. Calculate three estimated distances between each BS and MS using ed i = N i ×c F . 2. Generate three circle equations using the three estimated distances and center coordinates of BSs:

Mathematical Analysis of Enhanced TOA Trilateration Algorithms
The goal of this paper is to provide the validity of the line intersection algorithm and the shortest distance algorithm, as excellent location detection algorithms, through mathematical analysis and simulation results. In this section, we easily show that three straight lines considered in the line intersection algorithm, which connect two intersection points of a specific two circles of the entire three circles, always meet at a single point [46]. If we do not provide this mathematical proof, we cannot directly employ the line intersection algorithm without some sensitive conditions. In addition, the detailed analytic mathematic relation [47] between the shortest distance algorithm and the line intersection algorithm is presented.

Mathematical Verification for Line Intersection Algorithm
The line intersection algorithm has excellent performance for estimating the location of the MS and it is efficient in comparison to the shortest distance algorithm. However, it must assume that three lines, which connect two intersection points of two specific circles, meet at a single point. In this subsection, we mathematically show that they always meet at a single point and the above assumption is not required.
The solutions of the estimated MS location provided in (21) and (22) are the results from (17) and (18) based on BS1 and BS2, and BS2 and BS3. Therefore, if the estimated location coordinate, (x,ŷ), in (21) and (22) is satisfied to (19), three intersection lines should meet at a single point. In order to show this, we substitute (21) and (22) into the left side of (19) as follows:

Mathematical Relations between Two Algorithms
In this subsection, we provide mathematical analysis to show the relation between the shortest distance and line intersection algorithms. The line equation based on two intersection points of two circles obtained from the shortest distance algorithm is given by From the shortest distance algorithm, we find two coordinates of two circle intersection points from (8) to (11). From these equations, we get, and Substituting and rearranging (26)- (29) in (25), it can be rewritten as By solving (30), we obtain By substituting (4)- (6), and (7) in (31), we get From (32), we also obtain and (33) is finally simplified to Note that (34) is identical to the line equation connecting two intersections of two circles obtained from the line intersection algorithm in (17). From this process, we observe that line equations based on intersection points obtained from the shortest distance algorithm are identical to line equations obtained from the line intersection algorithm.

Computer Simulations
In this section, the computer simulation results are provided to compare the location estimation performances for the shortest distance algorithm, the line intersection algorithm, and least square technique, which works by making the total of the square of the errors as small as possible technique [48]. For the simulation, we assume that three fixed BSs are located at coordinates of (−1000, 5000), (6000, −4000), and (−7000, 500), respectively. The unit of each BS coordinate is in meters (m), and we consider the different sampling rates of 10 MHz, 50 MHz, 100 MHz, 500 MHz, 1 GHz, 5 GHz, and 10 GHz. The MS location coordinates are randomly chosen with ranges from −100 m to +100 m, from −600 m to +600 m, and −1000 m to +1000 m, for the first case, the second case, and the third case, respectively.

Error Model
The performance of the localization algorithm is generally evaluated by the mean square error (MSE) [49][50][51]. The error of the estimated distance between the MS and BS is defined as and MSE of the estimated distance is calculated as where E[ ] is an expectation operator. Similarly, the error between the true and the estimated MS location coordinates is defined as where this error is represented in the Euclidian distance. In addition, MSE for estimating the MS position is given by In order to accurately calculate MSE, the simulations are performed 100,000 times for each sampling rate.

Simulation Results
The simulation results for the distance MSE versus sampling rates are shown in Figures 6-8, for the first, second, and third cases, respectively. From figures, we observe that MSEs for estimating the distances between MS and BSs are decreased as the sampling rate is increased. In addition, we show simulation results to observe the MSE performances versus sampling rate for estimating the MS location and to compare them, for the shortest distance, the line intersection algorithms, the least square technique, in Figures 9-11, for the first, second, third cases, respectively. Note that we include the simulation results of the conventional technique based on the least square algorithm to compare both algorithm to the conventional algorithm in figures. From these results, we observe that the MSE curves of the line intersection algorithm are lower than them of the shortest distance algorithm and the least square algorithm for all cases. For a close-up look of the differences of MSE between three algorithms, we enlarge the plot in the sampling rate range from 10 9 Hz to 10 10 Hz, in Figures 12-14, for the first, second, third cases, respectively. From these figures, we see slightly distinct variations between algorithms in that range, though they seem to be closely overlapped in Figures 9-11. Table 3 shows the comparison between the line intersection algorithm, the shortest algorithm, and the least square algorithm, in terms of the location accuracy for specific sampling rates. From this table, we observe that the line intersection algorithm has the best performance compared to others, and that the least square technique has the worst performance compared others.                 The MSEs of the algorithms decreases as the sampling rate increases, which means that the performance of the estimated location of the MS based on the higher sampling rate is better than that of the lower sampling rate. Since the frequency is generally proportional to the sampling rate but inversely proportional to the time period, the resolution   The MSEs of the algorithms decreases as the sampling rate increases, which means that the performance of the estimated location of the MS based on the higher sampling rate is better than that of the lower sampling rate. Since the frequency is generally proportional to the sampling rate but inversely proportional to the time period, the resolution for estimating the distance between MS and BS is improved for the higher sampling rate,  The MSEs of the algorithms decreases as the sampling rate increases, which means that the performance of the estimated location of the MS based on the higher sampling rate is better than that of the lower sampling rate. Since the frequency is generally proportional to the sampling rate but inversely proportional to the time period, the resolution for estimating the distance between MS and BS is improved for the higher sampling rate, expecting the higher localization accuracy. Consequently, we verify that the location estimation performance of the line intersection algorithm is better, and it is more efficient than that of the shortest distance algorithm because the line intersection algorithm does not need to select three interior intersection points among the entire six intersection points unlike the shortest distance algorithm. In addition, the line intersection algorithm does not require the assumption that three intersection lines, which connect two intersection points of two circles among three entire circles, must meet at a single point, because we easily showed that they are always met at a single point.

Conclusions
The TOA trilateration approach determines the MS' location by using an intersection point of three circles based on the coordinates of three BSs and distances between MS and BSs. Since the distance between the MS and BS is generally estimated by counting the number of time delays, which should be an integer, the estimated distance may be elongated in comparison to the true distance. Thus, the radii of the circles based on BSs are increased, and three circles based on the estimated distances may not meet at a single point, causing a location estimation error. In order to solve this problem, the shortest distance algorithm, which selects three of the closest interior points among the entire six intersection points, was proposed. Although it has a generally good performance, it sometimes has a large error due to selecting the three nearest interior points in extreme cases. For this problem, we introduced the line intersection algorithm using the intersection point of three lines, connecting two intersection points of two specific circles. It has excellent performance and is efficient in comparison to the shortest distance algorithm because it does not need to choose three interior points. In this paper, we presented these two algorithms alongside detailed equations for the mathematical analysis. In addition, we easily showed that three intersection lines of the line intersection algorithm meet at a single point, to be used in all cases for estimating the location of the MS. In addition, we provided mathematical analysis to show the relationship between both algorithms.