Skip to main content

Mathematics Behind "Where is My Train" App

馃殕 Mathematics Behind "Where is My Train" App

In today’s digital world, apps like “Where is My Train” have made railway travel much easier. With just one click, we can know the exact location of a train, its delay, and expected arrival time. But have you ever wondered — what mathematics works behind this smart system?

Let’s explore the beautiful mathematics and logic behind this application in a simple and interesting way.




馃搷 1. Position Estimation (Basic Idea)

The main goal of the app is to find the current position of the train. Mathematically, this depends on:

Position = f(Time, Speed, Distance)

This means the location of the train depends on how fast it is moving and how much distance it has covered over time.


馃實 2. GPS and Distance Calculation

The app uses GPS coordinates (latitude 蠁 and longitude 位) to track the train in real time.
Each location on Earth is represented as a point (蠁₁, 位₁) and (蠁₂, 位₂).
To find the distance between these two points, we use the Haversine Formula.
First, compute the differences: 螖蠁 = 蠁₂ − 蠁₁ and 螖位 = 位₂ − 位₁.
Then calculate: a = sin²(螖蠁/2) + cos(蠁₁)·cos(蠁₂)·sin²(螖位/2).
Next step is: c = 2·atan2(√a, √(1−a)).
The distance is given by: d = R · c.
Here, R ≈ 6371 km is the radius of the Earth.
This formula accounts for Earth's curvature, making it highly accurate.
Using this, the app continuously calculates and updates the train’s position.

The distance between two points on Earth is calculated using the Haversine formula.
Each point is represented by latitude (蠁₁, 蠁₂) and longitude (位₁, 位₂).
First, compute the differences 螖蠁 = 蠁₂ − 蠁₁ and 螖位 = 位₂ − 位₁.
Then apply the formula to account for Earth's curvature.
d = 2R sin−1( √[ sin2(螖蠁/2) + cos(蠁₁)cos(蠁₂) sin2(螖位/2) ] )

This formula helps calculate the shortest distance between two points on the Earth's surface.


⏱️ 3. Speed Calculation

The speed of the train is calculated using a simple mathematical idea:

Speed = Distance / Time

By comparing the train’s previous location and current location over time, the app estimates how fast the train is moving.
The distance is calculated using GPS coordinates and formulas like the Haversine formula.
Time is measured as the difference between two recorded timestamps.
If the distance covered is large in a short time, the speed will be higher.
Similarly, if the distance is small over a longer time, the speed will be lower.
This continuous calculation helps provide real-time speed updates to users.


馃搳 4. Estimated Time of Arrival (ETA)

Once the speed is known, the app calculates the expected arrival time using:

ETA = Remaining Distance / Speed

However, real life is more complex. The app also considers:

  • Train delays
  • Station stops
  • Historical data

The app continuously updates the remaining distance using real-time GPS data.
Speed is adjusted dynamically based on current train movement.
If the train stops at a station, the ETA increases accordingly.
Past journey data helps improve prediction accuracy.
Machine learning models may also refine these estimates over time.
This makes the ETA more realistic and reliable for passengers.


馃摗 5. Tracking Without Internet (Smart Feature)

One of the most interesting features of this app is that it works even without internet!

It uses cell tower triangulation, where the position is estimated using signals from nearby towers.
By measuring signal strength from multiple towers, the app approximates the location.
This method is less accurate than GPS but still useful in low-network areas.
It ensures continuous tracking even when internet connectivity is lost.
Such smart techniques make the app highly reliable for travelers.

(x - x₁)² + (y - y₁)² = r₁² (x - x₂)² + (y - y₂)² = r₂²

This is based on coordinate geometry and solving equations.


馃 6. Machine Learning and Prediction

The app improves accuracy using machine learning techniques. It learns from past data and predicts delays.

Delay = f(Route, Time, Day, Historical Data)

This involves statistics and probability concepts.


馃敆 7. Graph Theory in Railway Network

Railway networks are modeled using graphs:

  • Stations → Vertices
  • Tracks → Edges

Algorithms like Dijkstra’s Algorithm are used to find shortest paths.


⚙️ 8. Error Correction Techniques

Real-world data is noisy, so the app uses:

  • Moving averages
  • Filtering techniques
  • Kalman Filter

These help improve accuracy and smooth predictions.


馃敟 Conclusion

The “Where is My Train” app is not just a simple tool — it is a powerful combination of:

  • Geometry
  • Calculus
  • Statistics
  • Graph Theory
  • Machine Learning

This shows how mathematics is deeply connected to real-life technology. Next time you check your train status, remember — mathematics is working behind the scenes!



馃殕 Real-Life Example: Gujarat Queen (19034)

Let us understand how mathematics works in real life using the example of the Gujarat Queen Express (19034), which runs between Ahmedabad and Valsad.

馃搷 Step 1: Current Situation

Suppose the train has just crossed Anand and is moving towards Vadodara.

  • Distance between Anand and Vadodara ≈ 45 km
  • Time taken so far = 30 minutes

⏱️ Step 2: Speed Calculation

Speed = Distance / Time = 45 / 0.5 = 90 km/h

So, the app estimates that the train is running at approximately 90 km/h.

馃搳 Step 3: Predicting Arrival Time

Now suppose the remaining distance to Vadodara is 15 km.

ETA = Remaining Distance / Speed = 15 / 90 = 0.167 hours ≈ 10 minutes

So, the app will show that the train will reach Vadodara in approximately 10 minutes.

馃摗 Step 4: Real-World Adjustment

However, in reality:

  • The train may slow down near stations
  • Signal delays may occur
  • Platform availability may affect arrival

So, the app adjusts the prediction using historical data and machine learning.

馃 Final Insight

This simple example shows that even a basic train tracking system uses:

  • Distance calculation
  • Speed estimation
  • Time prediction
  • Real-time data correction

馃憠 That is the beauty of mathematics — it turns real-world movement into precise predictions!

馃挕 Try Yourself

If a train is moving at 60 km/h and the remaining distance is 30 km, calculate the ETA.


馃摫 About the App Developer

The popular train tracking application “Where is My Train” was developed by an Indian startup called Sigmoid Labs.

This company was founded by Indian engineers who wanted to solve a common problem faced by railway passengers — finding the exact location of trains without relying heavily on the internet.

馃懆‍馃捇 Founder

The app was created by Abhishek Kumar, an engineer who focused on building a solution that works even in low network areas.

馃殌 Innovation

One of the most unique features of this app is that it can work offline using cell tower data instead of GPS alone.

This innovation made the app extremely popular among Indian railway users, especially in rural and low-network regions.

馃弳 Achievement

Due to its success, Google acquired Sigmoid Labs in 2018 to strengthen its own transportation and mapping services.

馃敆 Learn More

You can explore more details about the app and its features using the link below:


This app is a great example of how mathematics, technology, and innovation come together to solve real-world problems.

✍️ Written by Ajay Pathak | Mathematics Enthusiast

Comments

Popular posts from this blog

Mathematics in Indus valley civilization

Mathematics and the Indus Valley Civilization Mathematics and the Indus Valley Civilization 1. Historical Context of the Indus Valley Civilization Geographical Setting: The IVC was located in present-day northwest India and pakistan , primarily along the Indus River and its tributaries. Major cities included Harappa, Mohenjo-Daro, and Dholavira, known for their sophisticated urban planning. Timeframe: The civilization flourished between 3300 BCE and 1300 BCE, making it contemporary with ancient Mesopotamia and Egypt. It is believed to have declined around 1300 BCE due to various factors, including climate change and shifts in river patterns. Urban Planning: Cities were characterized by well-planned street grids, advanced drainage systems, and standardized fired brick structures. The use of mathematics was evident in the dimensions of buildings and the layout of streets. 2. Mathematical Knowledge in...

History of the October 1852 Calendar

History of the October 1582 Calendar The October 1582 Calendar: A Historic Transition The year 1582 marked a pivotal moment in the history of timekeeping. This year witnessed the adoption of the Gregorian calendar , which replaced the Julian calendar in several Catholic countries. This transition was introduced by Pope Gregory XIII to correct inaccuracies in the Julian calendar, particularly in the calculation of the spring equinox and Easter. Why the Change Was Necessary The Julian calendar, introduced by Julius Caesar in 45 BCE, was based on a solar year of 365.25 days. However, the true solar year is approximately 365.2422 days long. This slight discrepancy of about 11 minutes per year caused the calendar to drift gradually over centuries, misaligning with astronomical events like equinoxes. By the 16th century, the spring equinox had shifted by approximately 10 days, affecting the date of Easter . This was a significant concer...

Mathematics UZB Telegram Group

MATEMATIKA UZB Telegram Group Welcome to the MATEMATIKA UZB Telegram Group About the Group MATEMATIKA UZB is a dedicated Telegram group for math enthusiasts in Uzbekistan. The group is focused on solving various mathematics problems and sharing knowledge. Whether you're a student, teacher, or math lover, this community is a great place to discuss different mathematical topics, solve problems together, and improve your skills. In this group, you'll find: Problem-solving sessions Collaborative learning and discussions Support for various mathematics problems Helpful resources and guides for learning Group Rules Please be mindful of the following group rules to e...