Mathematics AA HL Internal Assessment For what values of learning rate does gradient descent converge and its ideal value forπ quadratic functions. 20 Pages 1
Introduction Simply put, gradient descent is an algorithm that estimates the coordinates of where a function outputs the lowest value. I initially discovered the gradient descent algorithm while I started working on a machine learning project that involved predicting road traffic and cross walk safety as I found neural networks and ML to be a very interesting topic at the time, especially when artificial intelligence initially became a topic of everyday conversation. As the project was merely for my entertainment and to satisfy my curiosity, I never investigated the parameters that overarch the training of my neural network. As a result the model converged extremely slowly as I chose a small learning rate to guarantee that it will converge. In gradient descent, if the learning rate is too high, it will instead diverge. At the time, I only used a python library that already implemented gradient descent, so it was a black box that meant nothing to me. Iβm now curious about the mathematics behind the algorithm as it is the basis of how weights in a neural network are optimized. Iβm deciding to study the algorithm mathematically as I want to discover whether there is a perfect learning rate, and if so, can we calculate it? I want to investigate the ideal learning rate parameter for different quadratic functions. Gradient descent is the algorithm that trains all neural networks. It is fundamental to the creation of all neural networks. It is behind things like image recognition machine learning models and language translation models like in google translate. It slowly adjusts the millions of parameters in each of the machine learning models that make them output increasingly accurate predictions after each adjustment for a certain set of input parameters. When we choose a poor learning rate, let;s say too high, each of the adjustments gradient descent makes may cause the algorithm to diverge insteadβit overshoots the minima of the functions and begins oscillating and not converging to the optimum. If it is too low, then the neural network will take much longer to train. Doing a mathematical analysis of learning rates in gradient descent through deriving relationships between 2
the variables in the algorithm that I can prove theoretically. Then, I want to verify it computationally after doing the theoretical analysis to ensure that my findings align with my practical results. To conduct my research, I will be basing it around using gradient descent on quadratic functions because they are simple enough to derive exact solutions. I can prove everything rigorously as I can derive closed form solutions while still covering the behavior essential for optimization problems. Gradient descent usually works to optimize multiple parameters. Quadratic functions also are a great middleground as near minima, functions often behave similar to a quadratic function like in the taylor series, the quadratic term becomes dominant when the first derivative nears zero at the minimum. Background The minimum of a function occurs when the derivative of a function equals 0, . Inπ(π₯) π'(π₯) = 0 multivariate environments, the vector that holds all of the partial derivatives of is , itπ(π₯1, π₯2, β¦, π₯3) βπ(π₯) contains the direction of the steepest ascent. Its magnitude , contains the βsteepnessβ in that direction||βπ(π₯)|| (GeeksforGeeks). While doing machine learning, it is impractical to solve for with millions of variables analytically, so we needβπ(π₯) = 0 an iterative approach instead. This is where gradient descent comes in. Gradient descent is an iterative algorithm that finds the minima of functions. It essentially follows the negative gradient and goes βdownhillβ, seen in Figure 1. It does this by updating with the rule where is the current position at iteration , is the next position at iterationπ₯π+1 = π₯π β Ξ±βπ(π₯π) π₯π π π₯π+1 , is the gradient at the current position, and is the learning rate(Ruder). A gradient is a vectorπ + 1 βπ(π₯π) Ξ± that contains all of the partial derivatives of , (Amari). So, we update ourβπ βπ = [ βπ βπ₯1 , βπ βπ₯2 , ..., βπ βπ₯π ] position by subtracting it by the vector that points to the steepest ascent, allowing us to descend the slope. For a 3
single variable function, the rule becomes . The process begins with . It computes theπ₯π+1 = π₯π β βπ'(π₯π) π₯0 gradient at that point, uses the rule to update the position, and repeats until we reach a stopping condition. The learning rate, , in the update rule is the coefficient that scales the vector , which means that itΞ± βπ controls the magnitude of how much the position is updated in each iteration(Amari). Itβs the step size in each iteration. When is too small, it takes more iterations to reach the minimum, while if is too large, theΞ± Ξ± algorithm either oscillates, or overshoots the minimum or completely diverges. This comes with the question of whether there is a sweet spot for the learning rate that optimizes the rate of convergence and reliability/stability. I aim to answer this by deriving the optimal learning rate for quadratic functions analytically. Convergence is when the algorithm causes to approach the minimum denoted . In the case ofπ₯π π₯* investigating parabolas, . Convergence can be defined as for when the iterationsπ₯* = 0 π β lim β π₯π = π₯* = 0 converges to a point at . When investigating convergence with an iterative function, we need to have aπ₯* stopping criteria as we cannot run iterations to infinity. Often, the threshold is when , where||βπ(π₯π)|| < Ξ΅ is the magnitude of the when is a threshold for how close can be to 0 before we stop. It||βπ(π₯π)|| Ξ΅ ||βπ(π₯π)|| means that when the function has found a value near to 0, within the threshold where there is no significantΞ΅ descent left, we stop gradient descent as it is considered complete. For our single variable functions, the stopping condition should be , so when the gradient is below the threshold . This works because when the|π'(π₯π)| < Ξ΅ Ξ΅ gradient is a small value, the function is near the minimum(Zhang), so it indicates our proximity to .π₯* Quadratic functions are written in the form . Importantly, they have a minimum at (0,0)π(π₯) = ππ₯2 and are convex functions when which guarantees that we find the global minimum if gradient descentπ > 0 converges. The derivative of the quadratic function in this form is , which makes it possible toπ'(π₯) = 2ππ₯ easily derive a closed form solution. 4
Analysis of π(π₯) = ππ₯2 Analytical Approach to Find Convergence Conditions The investigation will start with a mathematical approach to analytically derive the optimal learning rate for gradient descent. First, the update rule for gradient descent should be applied to the function :π(π₯) = ππ₯2 General update rule for gradient descent: π₯π+1 = π₯π β Ξ±βπ(π₯π) In this case, the term can be for a single variable function because whichΞ±βπ(π₯π) Ξ±π'(π₯π) Ξ±βπ(π₯π) = [ βπ βπ₯1 ] reduces to . Now we need the derivative of :Ξ± ππ ππ₯1 = Ξ±π'(π₯π) π(π₯π) = ππ₯π 2 and we substitute it into the update rule and the update rule for becomes:π'(π₯π) = 2ππ₯π π(π₯) = ππ₯2 and factor out :π₯π+1 = π₯π β 2Ξ±ππ₯π π₯π which is a geometric sequence.π₯π+1 = π₯π(1 β 2Ξ±π) Lets say that and recursively apply gradient descent to find the closed form solution:π = (1 β 2Ξ±π) π₯π+1 = ππ₯π π₯1 = ππ₯0 π₯2 = ππ₯1 π₯3 = ππ₯2 5
Which reveals a pattern when we substitute into following functions that allows us to generalize:π₯π andπ₯2 = π Β· ππ₯0 π₯3 = π Β· π Β· ππ₯0 Which means that for each iteration, we are multiplying by or . So after iterations, weπ₯0 π (1 β 2Ξ±π) π are multiplying by times. This allows us to find the closed form solution which is:π₯0 (1 β 2Ξ±π) π π₯π = π₯0(1 β 2Ξ±π)π This equation expresses the position of iteration in terms of directly. We do not need to calculateπ π₯0 the intermediate values. Proof by Induction of Analytical Approach I will prove by induction that for all .π₯π = π₯0(1 β 2Ξ±π)π π β β€+ Base case: When .π = 0 π₯π = π₯0(1 β 2Ξ±π)π π₯0 = π₯0(1 β 2Ξ±π)0 π₯0 = π₯0 Β· 1 βπ₯0 = π₯0 6
This is true because of the definition of , so the base case holds true.π₯0 Now we assume that for any , is true. If the formula is true for then isπ β₯ 0 π₯π = π₯0(1 β 2Ξ±π)π π should be true for . This shows the formula holds for :π + 1 π + 1 π₯π = π₯0(1 β 2Ξ±π)π π₯π+1 = (π₯0(1 β 2Ξ±π)π)(1 β 2Ξ±π) we apply the the exponent rule :ππ Β· ππ = ππ+π βπ₯π+1 = π₯0(1 β 2Ξ±π)π+1 Which proves the formula holds for .π + 1 By principle of mathematical induction, because it holds true for and if it holds for andπ = 0 π , the expression holds true for all .π + 1 π₯π = π₯0(1 β 2Ξ±π)π π β β€+ 7
Determining The Conditions for Convergence Now that has been derived and the form proven, we need to determine when theπ₯π = π₯0(1 β 2Ξ±π)π function converges. Convergence is when . So when we apply this to the expression π β lim β π₯π = 0 , then . Now, because is a constant of the initial position, theπ₯π = π₯0(1 β 2Ξ±π)π π β lim β π₯0(1 β 2Ξ±π)π = 0 π₯0 behavior of the limit is determined by the term .(1 β 2Ξ±π)π A geometric sequence will converge to 0 when when the base, , is . So ifπ’1ππ π β β π β 1 < π < 1 we apply this, then: , and simplifyβ 1 < 1 β 2Ξ±π < 1 , then flip the inequality after multiplying by -1β 2 <β 2Ξ±π < 0 0 < 2Ξ±π < 2 0 < Ξ±π < 1 So when , gradient descent will eventually converge to . It can also be written:0 < Ξ±π < 1 π₯* 0 < Ξ± < 1 π For any other value outside of this range, gradient descent will either diverge or remain stationary.Ξ± This reveals that the learning rate must be a positive value, to iterate towards the minimum, and the0 < Ξ± learning rate must be , not too large to avoid divergence from . It also reveals that the upper boundΞ± < 1 π π₯* depends on the vertical dilation of the parabola. The steeper the parabola, the smaller the maximum learning rate. These are the necessary conditions for gradient descent to converge on a parabola .π(π₯) = ππ₯2 8
Determining the Optimal Learning Rate Now that we have found the bounds for the learning rate that allow it to converge at all, we need to determine what value of in that range is the ideal. Within the bounds for the learning rateΞ± 0 < Ξ± < 1 π different learning rates converge at different speeds. The optimal learning rate should be defined as the value of Ξ± in which the number of iterations that are required to reach convergence is minimal. We have the closed form solution and from this, we can see that the commonπ₯π = π₯0(1 β 2Ξ±π)π ratio of the geometric sequence formed is , so the term determines how fast shrinks.(1 β 2Ξ±π) (1 β 2Ξ±π)π π₯π Each iteration of the algorithm multiplies the current position by the term , which means that if the(1 β 2Ξ±π) term is near 1, the function will converge slower than in the term is near 0. Since|1 β 2Ξ±π| |1 β 2Ξ±π| multiplying by a number closer to 0 allows for values to shrink rapidly, it means that we have to minimize in order to minimize the amount of iterations required to reach .|1 β 2Ξ±π| π₯π Letβs consider the function . We need to find the range of the function within theπ(Ξ±) = |1 β 2Ξ±π| domain . So then, we should find the sign of the function in the key areas of the function0 < Ξ± < 1 π :π(Ξ±) = 1 β 2Ξ±π Left BoundΞ± = 0 π(0) = 1 β 2(0)π π(0) = 1 π(0) = 1 Mid PointΞ± = 1 2π π( 1 2π ) = 1 β 2( 1 2π )π π( 1 2π ) = 1 β 2π 2π 9
π( 1 2π ) = 1 β 1 π( 1 2π ) = 0 Right BoundΞ± = 1 π π( 1 π ) = 1 β 2( 1 π )π π( 1 2π ) = 1 β 2π π π( 1 2π ) = 1 β 2 π( 1 2π ) =β 1 And since the function is linear, we can conclude that for the function when1 β 2Ξ±π 0 < Ξ± < 1 2π the function is always positive, while for , it is negative. Therefore, for the function 1 2π < Ξ± < 1 π , the minimum is at the vertex where . Now, we can try plugging itπ(Ξ±) = |1 β 2Ξ±π| Ξ± = 1 2π π( 1 2π ) = 0 into the closed form solution that we derived: then we substitute forπ₯π = π₯0(1 β 2Ξ±π)π 1 2π Ξ± π₯π = π₯0(1 β 2 1 2π π)π π₯π = π₯0(1 β 2π 2π )π π₯π = π₯0(1 β 1)π and now, when ,π₯π = π₯0(0)π π > 0 π₯π = 0 This means that for when gradient descent converges in 1 iteration. Letβs call the optimal learning rateΞ± = 1 2π Ξ±πππ‘ = 1 2π 10
Convergence Rate for Suboptimal Ξ± While the optimal value converges in one iteration, while using gradient descent in practicalΞ±πππ‘ = 1 2π applications, we may not use the optimal learning rate, especially as the functions used while performing gradient descent in ML applications are much more complex and model a dataset of which their loss functions may not have an easily derivable optimal learning rate or minimum analytically, which is the point of the iterative method. I will analyze how the number of iterations required for convergence varies with change in .Ξ± First, I need to derive an expression for the number of iterations required to converge as a function of .Ξ± We have the closed form solution and we need to find the number of iterations requiredπ₯π = π₯0(1 β 2 1 2π π)π for . We can do:|π₯π| < Ξ΅ , where|π₯π| < Ξ΅ |π₯π| = |π₯0||1 β 2 1 2π π|π and then solve for .|π₯π| = |π₯0||1 β 2 1 2π π|π < Ξ΅ π |1 β 2 1 2π π|π < Ξ΅ |π₯π| |1 β 2 1 2π π|π < Ξ΅ |π₯π| π Β· ππ|1 β 2 1 2π π| < ππ Ξ΅ |π₯π| And we have so which means that|1 β 2Ξ±π| < 1 ππ|1 β 2Ξ±π| < 0 and the number of iterations is then:π > ππ Ξ΅ |π₯π| ππ|1β2Ξ±π| or approximatelyπ = ππ Ξ΅ |π₯0| ππ|1β2Ξ±π| because must be an integerπ β ππ Ξ΅ |π₯0| ππ|1β2Ξ±π| π 11
The analysis of this reveals that when: , the convergences happens after the first step whenΞ± = Ξ±πππ‘ = 1 2π π = 1 , then k increases as decreases, which means convergence is slower, but there is noΞ± < Ξ±πππ‘ = 1 2π Ξ± overshooting. , then k increases as decreases, which means convergence is slower, and there is overshooting,Ξ± > Ξ±πππ‘ = 1 2π Ξ± causing an oscillating motion. The function still converges. , at the boundary, there is no convergence as . Meaning that for each iteration, we areΞ± = 1 π |1 β 2Ξ±π| = 1 multiplying by 1, causing no movement; therefore no convergence.π₯0 This also confirms that the value is optimal. We can also predict that when looking at aΞ±πππ‘ = 1 2π graph of in terms of , it will be a rough U shape, as seen in Figure 2 with a vertex at which I willπ Ξ± Ξ± = 1 2π verify computationally. 12
Breakdown of Analytical Findings The formula for the optimal learning rate reveals that we have an inverse relationshipΞ±πππ‘ = 1 2π between the coefficient of , , and the optimal learning rate :π₯2 π Ξ±πππ‘ π = 0. 5 β Ξ±_πππ‘ = 1 2Β·0.5 = 1 π = 1 β Ξ±_πππ‘ = 1 2Β·1 = 0. 5 π = 2 β Ξ±_πππ‘ = 1 2Β·2 = 0. 25 π = 4 β Ξ±_πππ‘ = 1 2Β·4 = 0. 125 And it shows how steeper parabolas, with a larger coefficient , will require smaller learning rates toπ converge optimally. This is because when the coefficient is larger, the gradient produced is steeper, meaningπ that algorithm will take larger steps because it steps in the vector of the negative gradient. Mathematically, determines the step size, so for optimal convergence,Ξ±Β·π'(π₯) = Ξ±Β·(2ππ₯) = 2Ξ±πΒ·π₯ , which also gives regardless of the current position . The convergence bound is2Ξ±π = 1 Ξ± = 1/(2π) π₯π defined by this step size. The convergence bound is and the optimal , is exactly half of the0 < Ξ± < 1 π Ξ± Ξ±πππ‘ upper bound . This means the optimal value is exactly at the midpoint of which makesΞ±πππ‘ = 1 2π 1 β 2Ξ±π sense because the optimal learning rate balances the behavior of both of the upper and lower convergence boundaries, neither undershooting nor overshooting. I will verify this computationally. 13
Computational Analysis of The Relationship Between andπ Ξ± Experimental Setup I created an application in python that allows me to set parameters for gradient descent and run many trials of gradient descent at different values for in order to determine the value of computationally. TheΞ± Ξ±πππ‘ parameters that will remain consistent for all of the trials are , but I will be changingπ₯β = 10, Ξ΅ = 0. 001 the values for : . My implementation of gradient descent initiates the position at , thenπ {0. 5, 1, 5} π₯β = 10 computes the gradient at , , then it uses the update rule to update theπ₯π π(π₯π) = 2ππ₯π π₯π+1 = π₯π β Ξ±π'(π₯π) position, and then checks the criteria to stop . If the stopping criteria is not reached, gradient|π'(π₯π)| < Ξ΅ descent continues. The learning rate will sweep from a value of 0.001 to 2 with a step size of 0.001, then I will graph the number of iterations to converge to the learning rate. Results of Experiment Graph of Number of Iterations to Convergence to Learning Rate Logarithmic, π = 0. 5 (Photo by author, Figure 3) 14
As we can see in Figure 3, the learning rate, when graphed logarithmically, shows a minimum at Ξ± = 1 when . This aligns with our result that the because . The resultπ = 0. 5 Ξ±πππ‘ = 1 2π Ξ±πππ‘ = 1 2Β·0.5 = Ξ±πππ‘ = 1 of this experiment has confirmed the theoretical result that at , at least for , the algorithmΞ±πππ‘ = 1 2π Ξ± = 1 converges in exactly 1 iteration, while for other learning rates, there is a significant increase in the learning rate as the learning rate diverges from . It also shows that at the upper bound, , the algorithmΞ±πππ‘ = 1 2π Ξ± = 1 0.5 = 2 doesnβt converge, but instead diverges at the red points, confirming the theoretical results. It also reveals the U shaped curve that we expected from the expression . We can see that on the right side of the curve,π β ππ Ξ΅ |π₯0| ππ|1β2Ξ±π| the learning rate is smaller, slowing down convergence very dramatically. At , at 10% the optimal, theΞ± = 0. 1 convergence rate is significantly increased and took 88 iterations to converge in Figure 3. This shows that learning rates before optimal show a significantly increased amount of iterations to converge. The same is also true for the opposite. Learning rates that are higher than the optimal value mimic the behavior of the learning rates below the optimal, showing how the absolute difference between the learning rate and the ideal learning rate affects the amount of iterations until convergence. This is, until the learning rate goes outside of the upper bound, which causes gradient descent to diverge or stay stationary. We can also see that as the learning rate approaches each of the bounds, the learning rate begins to increase extremely rapidly, costing up to 9,000 iterations before convergence. 15
This should emphasize the importance of optimizing the learning rate, because a deviation from the by a factor of 2 can cause the gradient descent algorithm to never converge at all, and even a deviationΞ±πππ‘ smaller can cause learning rates to be orders of magnitude higher. We can check this with the expression we derived: π β ππ Ξ΅ |π₯0| ππ|1β2Ξ±π| π β ππ 0.001 10 ππ|1β2(0.1)(0.5)| β 88 π β β9.210 ππ|1β0.1| β 88 π β β9.210 ππ|0.9| β 88 π β β9.210 β0.10536 β 88 which rounds up, as the iteration must complete.π β 87. 4145 β 88 16
Now, if we look at the graphs for both , we can see other patterns in the behavior of theπ = 0. 5, 1, πππ 5 convergence speed: Graph of Number of Iterations to Convergence to Learning Rate Logarithmic, π = 1 (Photo by author, Figure 4) Graph of Number of Iterations to Convergence to Learning Rate Logarithmic, π = 5 (Photo by author, Figure 5) If we compare figures 3, 4, and 5, we can see a clear pattern in the shape of the graph formed and also the shift in the bounds of the possible learning rates. We predicted that the bounds would be , and0 < Ξ± < 1 π that the upper bound would have an inverse relationship with the coefficient . This is shown to be consistentlyπ true here, where the bound for , Figure 3, is 2, the bound for , Figure 4, is 1, the bound forπ = 0. 5 π = 1 17
, Figure 5, is 0.2. We also predicted in theory that the ideal learning rate would be at the midpointπ = 5 between the two bounds, at . This remains true for all where they are 1 2π π = 0. 5, 1 , 5 Ξ± = 1, 0. 5, 0. 1 respectively. But what we see here, importantly, is the narrowing of the optimal region and the bound for convergence overall. Since the lower bound is constant, 0, and the upper bound is inversely proportional to , soπ it decreases as increases, the convergence rangeβs width decreases. The consistent shape of the U in the graphπ can also be observed. Despite the narrowing of the convergence range and the horizontal dilation, the shape of the graph remains consistent. We also consistently observe that at , there is a consistent trend of convergenceΞ±πππ‘ after only 1 iteration. We also see a consistent shift in the range of the three graphs. For , the rangeπ = 0. 5, 1 , 5 shrinks as the value of increases.π There is a strong validation of the theoretical analysis in the experimental data. We can observe all of the patterns discussed in the theoretical analysis. The optimal learning rate shows an inverse relationship with the size of the coefficient and also consistently is at the midpoint of the bounds that allow gradient descent toπ converge . We also see that the range that allows the function to converge decreases inversely to0 < Ξ± < 1 π π because of the upper bound. This means that as the functions get steeper, choosing the learning rate becomes less lenient. 18
Conclusion The investigation aimed to investigate the relationship between the learning rate and convergence in aΞ± quadratic function with gradient descent. The investigation derived the optimal learning rate parameter and also other relationships between the properties of the quadratic function and the learning rate. We found that the optimal learning rate for a quadratic function was which minimizes the amount ofπ(π₯) = ππ₯2 Ξ±πππ‘ = 1 2π iterations until convergence to 1. We found the conditions required for convergence in terms of the coefficient of the term which establishes the range for the learning rate that is stable for the specific parabolaπ₯2 0 < Ξ± < 1 π with coefficient . Importantly, the optimal learning rate allows the function to converge withinπ Ξ±πππ‘ = 1 2π exactly 1 iteration which is inversely proportional to coefficient . This means in practice, that for steeperπ functions, the learning rate needs to be smaller, or else gradient descent will overshoot the minimum of the function and possibly not converge at all. The theoretical analysis was then verified with experimental trials, showing that in practice, all of the boundaries and the optimal learning rate were consistent with the theoretical analysis. Through the experimental trials, we also determined that the deviation from causes a significantΞ±πππ‘ increase in iteration count. This emphasizes the importance of choosing an ideal learning rate for a specific machine learning model. 19
Works Cited Amari, Shun-ichi. βBackpropagation and Stochastic Gradient Descent Method.β Neurocomputing, vol. 5, no. 4-5, June 1993, pp. 185β196, www.sciencedirect.com/science/article/abs/pii/092523129390006O, https://doi.org/10.1016/0925-2312(93)90006-o. Accessed 18 Feb. 2026. GeeksforGeeks. βWhat Is Gradient Descent.β GeeksforGeeks, 23 Jan. 2025, www.geeksforgeeks.org/machine-learning/what-is-gradient-descent/. Accessed 18 Feb. 2026. Rekha. βThe Ascent of Gradient Descent.β Medium, 8 June 2020, blog.clairvoyantsoft.com/the-ascent-of-gradient-descent-23356390836f. Accessed 18 Feb. 2026. Ruder, Sebastian. βAn Overview of Gradient Descent Optimization Algorithms.β ArXiv.org, 2016, arxiv.org/abs/1609.04747. Accessed 18 Feb. 2026. Zhang, Jiawei. Gradient Descent Based Optimization Algorithms for Deep Learning Models Training. Feb. 2019. 20