<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Matheria Study</title>
    <description>The latest articles on DEV Community by Matheria Study (@matheria_study).</description>
    <link>https://dev.to/matheria_study</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4252575%2F9891939b-7c28-40e0-9410-5b9db4450f77.png</url>
      <title>DEV Community: Matheria Study</title>
      <link>https://dev.to/matheria_study</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/matheria_study"/>
    <language>en</language>
    <item>
      <title>A one-sample t statistic in Python: what the number actually compares</title>
      <dc:creator>Matheria Study</dc:creator>
      <pubDate>Wed, 18 Nov 2026 21:20:38 +0000</pubDate>
      <link>https://dev.to/matheria_study/a-one-sample-t-statistic-in-python-what-the-number-actually-compares-4m9e</link>
      <guid>https://dev.to/matheria_study/a-one-sample-t-statistic-in-python-what-the-number-actually-compares-4m9e</guid>
      <description>&lt;p&gt;A two-point difference can be a big deal or ordinary sampling noise. The t statistic compares that difference with the estimated uncertainty in the sample mean.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with a runnable example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sqrt&lt;/span&gt;
&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;null_mean&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sample_sd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;
&lt;span class="n"&gt;standard_error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sample_sd&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;null_mean&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;standard_error&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;standard_error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 1.0 2.0 15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code computes a statistic, not a p-value. Here t = 2 with 15 degrees of freedom gives a two-sided p-value of about 0.064. An exact one-sample t test assumes independent normal observations; approximate use needs care with small samples, skew and outliers. The estimated standard deviation must be positive. A threshold decision also says nothing by itself about practical importance.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Fictional student scene: In a bustling campus cafe, Sam triumphantly declares that his newly modified electric kettle saves precious study time because one cup boiled an observable fraction of a second faster. When his lab partner, Maya, calmly asks to see more measurements and checks for ambient water temperature variations, Sam crosses his arms and calls her skepticism an attack on innovation. Maya sighs, knowing that a single observation cannot establish the claimed improvement.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;The core idea: Signal versus noise&lt;/h3&gt;

&lt;p&gt;A one-sample t-test is designed precisely to resolve disputes like Sam's. It compares a population mean, denoted by the Greek letter μ, with a specified hypothesized value (represented as μ₀) when the population standard deviation (σ) is completely unknown. Instead of relying on a single trial, we gather a sample of observations to calculate an observed mean difference (sample mean minus hypothesized mean) and scale it against our estimated uncertainty—known as the estimated standard error.&lt;/p&gt;

&lt;p&gt;In notation, the test statistic is calculated as t = (x̄ - μ₀) / (s / sqrt(n)), where x̄ is the sample mean, s is the sample standard deviation, and n is the sample size. The same difference gives stronger evidence when the estimated sampling uncertainty is smaller. Note that this is one specific flavor of hypothesis testing; paired designs and independent-group designs require entirely different experimental layouts and formulas.&lt;/p&gt;

&lt;h3&gt;Follow the numbers&lt;/h3&gt;

&lt;p&gt;Let us examine Sam's boiling time experiment after Maya convinced him to collect a proper dataset. Suppose Sam records 25 independent observations, so n = 25. He finds a sample mean boiling time of x̄ = 52 seconds, with a sample standard deviation of s = 10 seconds. He wants to test the null hypothesis H₀: μ = 50 against the two-sided alternative hypothesis H₁: μ not equal to 50 at a prechosen significance level of α = 0.05.&lt;/p&gt;

&lt;p&gt;First, we compute the estimated standard error, which measures how much sample means are expected to fluctuate purely by chance. The formula is s / sqrt(n). Plugging in our numbers gives 10 / sqrt(25) = 10 / 5 = 2. Next, we calculate the t-statistic: t = (52 - 50) / 2 = 2 / 2 = 1. This tells us that Sam's observed sample mean is exactly 1 estimated standard error above the hypothesized population mean of 50.&lt;/p&gt;

&lt;p&gt;With n = 25, our degrees of freedom are df = n - 1 = 25 - 1 = 24. A two-sided p-value uses both tails of a Student's t-distribution with 24 degrees of freedom. For t = 1, the resulting two-sided p-value is approximately 0.327. Because 0.327 is substantially larger than our significance threshold of 0.05, we fail to reject the null hypothesis. There is insufficient statistical evidence to claim the true mean boiling time differs from 50 seconds.&lt;/p&gt;

&lt;h3&gt;Assumptions come before the p-value&lt;/h3&gt;
&lt;p&gt;For the exact one-sample t reference distribution, assume an independent random sample from a normal population with finite, positive variance. The numerical examples use this teaching model. Larger samples can support approximations, but dependence, severe outliers, selection bias and strongly skewed small samples require care. Repeated tests of the same network or kettle may be dependent; collecting more rows is not the same as collecting independent information.&lt;/p&gt;
&lt;h3&gt;Try another example&lt;/h3&gt;

&lt;p&gt;Consider a second scenario involving a different batch of measurements. Suppose a researcher studies campus internet download speeds. A historical baseline states the average speed is μ₀ = 100 megabits per second. The researcher collects a sample of n = 16 connection tests, yielding a sample mean of x̄ = 94 megabits per second and a sample standard deviation of s = 12 megabits per second. We wish to test H₀: μ = 100 versus H₁: μ not equal to 100 at a 0.05 significance level.&lt;/p&gt;

&lt;p&gt;We calculate the estimated standard error: s / sqrt(n) = 12 / sqrt(16) = 12 / 4 = 3. Then, we compute the t-statistic: t = (x̄ - μ₀) / SE = (94 - 100) / 3 = -6 / 3 = -2. The degrees of freedom are df = 16 - 1 = 15. Looking up a t-distribution with 15 degrees of freedom, the two-sided p-value for a magnitude of 2 or more extreme is approximately 0.064. Since 0.064 is greater than 0.05, we again fail to reject the null hypothesis at the 5 percent level, though the evidence is closer to conventional thresholds.&lt;/p&gt;

&lt;h3&gt;Three common mistakes to avoid&lt;/h3&gt;

&lt;p&gt;Interpreting hypothesis tests requires discipline. Avoid these frequent pitfalls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Equating failing to reject with proving the null:&lt;/strong&gt; Failing to reject H₀ never proves that μ equals the hypothesized value. It simply means our data lack the statistical power or clarity to rule it out. Absence of evidence is not evidence of absence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reusing old reference distributions:&lt;/strong&gt; Changing your sample size alters your degrees of freedom (df = n - 1), which alters the shape of the t-distribution. If n changes from 25 to 100, you cannot reuse critical values or p-value calculations from the old distribution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confusing statistical significance with practical importance:&lt;/strong&gt; A tiny deviation can yield a massive t-statistic and a tiny p-value if your sample size is gigantic, even if the real-world difference is trivial. Conversely, a large, important difference might fail to reach significance in a tiny sample.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Try it yourself, then check&lt;/h3&gt;

&lt;p&gt;Test your understanding with these practice problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 1:&lt;/strong&gt; Keep the sample mean at x̄ = 52 and sample standard deviation at s = 10, but increase the sample size from n = 25 to n = 100. What happens to the t-statistic and degrees of freedom? Answer: The standard error falls from 10 / sqrt(25) = 2 down to 10 / sqrt(100) = 1. Consequently, the t-statistic doubles from (52 - 50) / 2 = 1 to (52 - 50) / 1 = 2. The degrees of freedom increase from 24 to 99.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 2:&lt;/strong&gt; Suppose n = 9, x̄ = 48, s = 6, and we test H₀: μ = 50. Compute the t-statistic and degrees of freedom. Answer: The standard error is 6 / sqrt(9) = 6 / 3 = 2. The t-statistic is (48 - 50) / 2 = -2 / 2 = -1. The degrees of freedom are 9 - 1 = 8.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 3:&lt;/strong&gt; If a one-sample t-test yields a p-value of 0.012 at a prechosen significance level of α = 0.05, what is the correct statistical decision? Answer: Since the p-value (0.012) is less than the significance level (0.05), we reject the null hypothesis in favor of the alternative hypothesis.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Sources and further reading&lt;/h3&gt;

&lt;p&gt;For additional foundational reading and worked problems, consult &lt;a href="https://openstax.org/books/introductory-statistics-2e/pages/index" rel="noopener noreferrer"&gt;the linked open learning reference&lt;/a&gt;. The worked examples presented throughout this guide are original teaching examples designed to illustrate core principles without relying on empirical human measurements.&lt;/p&gt;

&lt;p&gt;We are building Matheria for calculation, organized study, and learning resources. &lt;a href="https://matheria.app/?utm_source=dev&amp;amp;utm_medium=article&amp;amp;utm_campaign=student_questions_20&amp;amp;utm_content=t-test" rel="noopener noreferrer"&gt;Explore Matheria&lt;/a&gt;. Which step of the standard error calculation should we break down further in a follow-up? Leave a specific question.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Editorial note: Prepared with AI assistance and discussed with Gemini before publication. Student scenes and datasets are fictional unless stated otherwise. The cover is AI-generated conceptual artwork, not experimental evidence.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;References for implementation: &lt;a href="https://docs.python.org/3/library/statistics.html" rel="noopener noreferrer"&gt;https://docs.python.org/3/library/statistics.html&lt;/a&gt; and &lt;a href="https://numpy.org/doc/stable/reference/generated/numpy.linalg.cond.html" rel="noopener noreferrer"&gt;https://numpy.org/doc/stable/reference/generated/numpy.linalg.cond.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>data</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>A zero determinant is a warning that your matrix loses information</title>
      <dc:creator>Matheria Study</dc:creator>
      <pubDate>Wed, 18 Nov 2026 21:19:12 +0000</pubDate>
      <link>https://dev.to/matheria_study/a-zero-determinant-is-a-warning-that-your-matrix-loses-information-eem</link>
      <guid>https://dev.to/matheria_study/a-zero-determinant-is-a-warning-that-your-matrix-loses-information-eem</guid>
      <description>&lt;p&gt;A program can multiply by a matrix perfectly and still throw information away. The multiplication succeeds. Getting the original input back is the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with a runnable example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;det2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Expected a 2 by 2 matrix"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;det2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 3&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;det2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This exact integer example helps us see the algebra. In floating-point numerical work, testing det(A) == 0 is not a reliable general-purpose singularity test: scale, rounding and conditioning matter. Use suitable numerical solvers and rank or condition diagnostics. The geometry explains why information is lost; the tiny function is not a production linear-algebra library.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Fictional student scene: In a hasty online purchase, Leo buys a custom hallway rug after measuring only the length of his corridor. When the delivery arrives, the runner fits the longitudinal span perfectly, but its bulk completely jams every single bedroom and bathroom door from opening. Leo stands frustrated, realizing that measuring only one dimension tells you nothing about spatial area or multi-variable clearance. Later that afternoon in linear algebra class, his professor notes that matrices demand that you respect all dimensions simultaneously.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;The core idea: How matrices warp space&lt;/h3&gt;

&lt;p&gt;Think of a 2×2 matrix as a rule for moving points: a linear transformation that stretches, shears, rotates, or reflects the entire two-dimensional Cartesian plane. Specifically, a 2x2 matrix A can be written as A = [[a, b], [c, d]], where the columns represent where the standard basis vectors land. The first column vector (a, c) shows the destination of the horizontal unit basis vector pointing from (0, 0) to (1, 0), while the second column vector (b, d) shows the destination of the vertical unit basis vector pointing from (0, 0) to (0, 1).&lt;/p&gt;

&lt;p&gt;The determinant of this matrix, denoted as det(A) or written using vertical bars, is calculated using the two-by-two determinant formula: det(A) = ad - bc. Geometrically, the absolute value of this number represents the area scale factor. If you take any region in the plane and apply the linear transformation defined by matrix A, the area of that region is multiplied by the absolute value of the determinant. Furthermore, the sign of the determinant carries crucial geometric information: a positive determinant indicates that the orientation or handedness of the coordinate plane is preserved, whereas a negative determinant signifies that space has been flipped over like a mirrored reflection. The determinant is one powerful summary number about a transformation, but it does not tell you every single property of that transformation.&lt;/p&gt;

&lt;h3&gt;Follow the numbers&lt;/h3&gt;

&lt;p&gt;Let us examine a concrete transformation by taking the matrix A = [[2, 1], [0, 3]]. Under this linear map, the horizontal unit basis vector (1, 0) is transformed into the vector (2, 0), and the vertical unit basis vector (0, 1) is transformed into the vector (1, 3). If you sketch these transformed vectors on a grid starting from the origin, they span a parallelogram. The base of this parallelogram lies along the x-axis with a length of 2, and its height extends vertically to 3. Using basic geometry, the area of this parallelogram is base times height, which equals 2 multiplied by 3, giving an area of 6.&lt;/p&gt;

&lt;p&gt;The algebraic determinant formula yields the exact same result: ad - bc equals (2 multiplied by 3) minus (1 multiplied by 0), which evaluates to 6 minus 0, or 6. Every planar region subjected to this linear map has its area multiplied by a scale factor of 6. Now consider a contrasting matrix B = [[1, 2], [2, 4]]. If we compute its determinant, we get (1 multiplied by 4) minus (2 multiplied by 2), which equals 4 minus 4, which is 0. Geometrically, the columns of B lie on the exact same linear ray because the second column is a scalar multiple of the first. When a transformation maps both basis vectors onto a single shared line, the entire two-dimensional plane collapses into a flat one-dimensional line, resulting in an area scale factor of zero.&lt;/p&gt;

&lt;h3&gt;Try another example&lt;/h3&gt;

&lt;p&gt;Consider a second transformation defined by the matrix C = [[-3, 0], [0, 2]]. Here, the horizontal basis vector (1, 0) maps to (-3, 0), stretching it three units leftward along the x-axis, while the vertical basis vector (0, 1) maps to (0, 2), stretching it two units upward along the y-axis. To find the determinant, we compute ad - bc: (-3 multiplied by 2) minus (0 multiplied by 0), which equals -6.&lt;/p&gt;

&lt;p&gt;The absolute value of this determinant is | -6 | = 6, meaning that any geometric shape transformed by matrix C will have its area multiplied by 6. The negative sign reveals that the orientation of the coordinate plane has been reversed—the horizontal axis was flipped to point left instead of right. Just like Leo's rug blocking the doors, ignoring the directional sign and scaling properties of a matrix transformation can lead to unexpected geometric consequences.&lt;/p&gt;

&lt;h3&gt;Three common mistakes to avoid&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Confusing a zero determinant with a zero matrix:&lt;/strong&gt; A determinant of zero simply means the matrix is singular and collapses dimensions, but it does not imply that all entries inside the matrix are zero.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treating a negative determinant as a negative physical area:&lt;/strong&gt; Areas cannot be negative in the physical world. When measuring scaling factors, always take the absolute value of the determinant; the negative sign merely indicates orientation reversal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Miscalculating scalar multiplication scaling:&lt;/strong&gt; If you multiply every single entry of a 2x2 matrix by a scalar constant k, its determinant is multiplied by k squared (k²), not by k. For instance, scaling a 2x2 matrix by 3 multiplies its determinant by 9.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Try it yourself, then check&lt;/h3&gt;

&lt;p&gt;Test your conceptual understanding of determinants with these three guided exercises:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 1:&lt;/strong&gt; What is the area scale factor and orientation effect of the matrix [[-2, 0], [0, 3]]? Answer: The determinant is (-2 multiplied by 3) minus (0 multiplied by 0), which equals -6. The absolute value is 6, so the area scale factor is 6, and the negative sign indicates that orientation is reversed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 2:&lt;/strong&gt; Compute the determinant of the matrix D = [[4, -1], [2, 5]]. Answer: Using ad - bc, we get (4 multiplied by 5) minus ((-1) multiplied by 2), which evaluates to 20 minus (-2), giving a total determinant of 22 and an area scale factor of 22.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 3:&lt;/strong&gt; If a 2x2 matrix M has a determinant of 5, what is the determinant of the scaled matrix 3M? Answer: For a 2x2 matrix, multiplying every entry by a scalar k scales the determinant by k squared. Therefore, det(3M) equals 3 squared multiplied by det(M), which is 9 multiplied by 5, resulting in 45.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Sources and further reading&lt;/h3&gt;

&lt;p&gt;For additional reading, practice problems, and comprehensive linear algebra chapters, consult &lt;a href="https://openstax.org/books/college-algebra-2e/pages/index" rel="noopener noreferrer"&gt;the linked open learning reference&lt;/a&gt;. The worked examples presented throughout this article are original teaching examples crafted to build clear geometric intuition.&lt;/p&gt;

&lt;p&gt;We are building Matheria for calculation, organized study, and learning resources. &lt;a href="https://matheria.app/?utm_source=dev&amp;amp;utm_medium=article&amp;amp;utm_campaign=student_questions_20&amp;amp;utm_content=determinant" rel="noopener noreferrer"&gt;Explore Matheria&lt;/a&gt;. Which step of the geometric area scaling calculation should we break down further in a follow-up? Leave a specific question.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Editorial note: Prepared with AI assistance and discussed with Gemini before publication. Student scenes and datasets are fictional unless stated otherwise. The illustration is a calculated educational diagram, not an empirical study.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;References for implementation: &lt;a href="https://docs.python.org/3/library/statistics.html" rel="noopener noreferrer"&gt;https://docs.python.org/3/library/statistics.html&lt;/a&gt; and &lt;a href="https://numpy.org/doc/stable/reference/generated/numpy.linalg.cond.html" rel="noopener noreferrer"&gt;https://numpy.org/doc/stable/reference/generated/numpy.linalg.cond.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>programming</category>
      <category>python</category>
    </item>
    <item>
      <title>Why two standard deviation functions can disagree without either being broken</title>
      <dc:creator>Matheria Study</dc:creator>
      <pubDate>Wed, 18 Nov 2026 21:11:46 +0000</pubDate>
      <link>https://dev.to/matheria_study/why-two-standard-deviation-functions-can-disagree-without-either-being-broken-1ljd</link>
      <guid>https://dev.to/matheria_study/why-two-standard-deviation-functions-can-disagree-without-either-being-broken-1ljd</guid>
      <description>&lt;p&gt;You check the same three numbers in two places. One answer is about 1.63. The other is 2. Before blaming floating-point arithmetic, check the denominator.&lt;/p&gt;

&lt;h2&gt;
  
  
  A small example you can run
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;statistics&lt;/span&gt;
&lt;span class="n"&gt;values&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;statistics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pstdev&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 1.632993161855452&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;statistics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stdev&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# 2.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a descriptive standard deviation of this complete list, the population convention divides by n. To estimate population variance from an independent identically distributed sample, the usual sample variance divides by n−1; taking its square root gives the sample standard deviation, which is not itself generally unbiased. Python names the choice explicitly: pstdev versus stdev. Which convention does your assignment or application need?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Fictional student scene: Two flatmates, Leo and Sam, both average five hours of study a day across a six-day stretch. Leo sits at his desk for exactly five hours every single afternoon, maintaining a steady, predictable rhythm. Sam alternates between two 15-hour marathon sessions fueled by panic and four days of staring meaningfully at a closed textbook while questioning his life choices. Their arithmetic averages agree completely. Their lived reality, concentration levels, and academic stamina do not.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;The core idea: why averages alone hide the story&lt;/h3&gt;

&lt;p&gt;A statistical average—specifically the arithmetic mean—tells you where the center of gravity lies, but it tells you nothing about how chaotic or uniform the surrounding terrain is. &lt;strong&gt;Standard deviation&lt;/strong&gt; is the standard mathematical tool designed to measure dispersion or spread around that mean. A larger standard deviation means that individual data points are scattered more widely from the center. A larger standard deviation means more variation. Whether that is a problem depends on what you are measuring.&lt;/p&gt;

&lt;p&gt;Let a collection of numerical observations be represented by x_1, x_2, …, x_n, where n is the total count of observations. The population arithmetic mean is denoted by μ (mu), calculated by summing all values and dividing by n:
μ = (x₁ + x₂ + … + xₙ) / n&lt;/p&gt;

&lt;p&gt;When you measure how far each observation sits from the center, you look at the raw deviation, x_i - μ. If you simply add up these raw deviations without modifying them, the positive deviations (values above the mean) and negative deviations (values below the mean) will always cancel each other out, summing precisely to zero. To prevent this cancellation, we square each deviation: (x_i - μ)^2. Squaring ensures every term is non-negative and heavily penalizes values that sit far away from the center. Averaging these squared deviations gives us the population variance, σ^2 (sigma squared):
σ² = [(x₁ − μ)² + (x₂ − μ)² + … + (xₙ − μ)²] / n&lt;/p&gt;

&lt;p&gt;Because squaring changes our units (for instance, turning hours of study into squared hours), we take the non-negative square root of the variance to return the metric to the original units of measurement. This gives us the population standard deviation, σ:&lt;/p&gt;

&lt;p&gt;σ = sqrt(variance)&lt;/p&gt;

&lt;h3&gt;Step-by-step worked example: population versus sample&lt;/h3&gt;

&lt;p&gt;Let us work through a concrete numerical dataset. Treat the values 2, 4, 4, and 6 as an entire closed population (n = 4).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 1: Find the mean.&lt;/strong&gt; Sum the observations (2 + 4 + 4 + 6 = 16) and divide by n = 4, giving a mean μ= 4.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Step 2: Calculate deviations from the mean.&lt;/strong&gt; Subtract 4 from each value: 2 - 4 = -2, 4 - 4 = 0, 4 - 4 = 0, and 6 - 4 = 2.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Step 3: Square each deviation.&lt;/strong&gt; (-2)^2 = 4, 0^2 = 0, 0^2 = 0, and 2^2 = 4.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Step 4: Average the squared deviations.&lt;/strong&gt; Sum the squares (4 + 0 + 0 + 4 = 8) and divide by n = 4. This gives the population variance: 8/4 = 2.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Step 5: Take the square root.&lt;/strong&gt; The population standard deviation is σ= √(2) ≈1.414.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What if these exact same four values—2, 4, 4, and 6—are not a closed population, but rather a random &lt;strong&gt;sample&lt;/strong&gt; drawn to estimate the spread of a broader group? In inferential statistics, dividing the squared deviations from the sample mean by n is biased downward, on average, as an estimator of population variance because our sample mean is already pulled toward the sample points. To correct this, we use Bessel's correction, dividing by n - 1 instead of n. For our sample (n = 4, so n - 1 = 3):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The sum of squared deviations remains 8.&lt;/li&gt;
&lt;li&gt;The sample variance becomes s^2 = 8/3 ≈2.667.&lt;/li&gt;
&lt;li&gt;The sample standard deviation is s = √(8/3) ≈1.633.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;A second worked example: evaluating a stable study week&lt;/h3&gt;

&lt;p&gt;Consider a second fictional dataset of study-hour observations: 3, 5, 5, and 7.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mean:&lt;/strong&gt; μ = (3 + 5 + 5 + 7)/4 = 20/4 = 5.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deviations:&lt;/strong&gt; 3 - 5 = -2, 5 - 5 = 0, 5 - 5 = 0, 7 - 5 = 2. Notice that these deviations are identical in magnitude to our first example, even though the center shifted from 4 to 5.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Squared deviations:&lt;/strong&gt; 4, 0, 0, 4.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Population variance:&lt;/strong&gt; 8/4 = 2, and population standard deviation σ= √(2) ≈1.414.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This demonstrates a fundamental property of standard deviation: shifting every data point up or down by adding a constant value moves the mean but leaves the spread—and therefore the standard deviation—completely untouched.&lt;/p&gt;

&lt;h3&gt;Three common mistakes to avoid&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mistake 1: Choosing the denominator by habit rather than context.&lt;/strong&gt; Always check whether your dataset represents an entire defined population (divide by n) or a sample intended to estimate a wider population (divide by n - 1). Blindly applying one formula everywhere introduces systematic bias.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mistake 2: Assuming the n - 1 correction makes sample standard deviation unbiased.&lt;/strong&gt; While dividing by n - 1 makes the sample &lt;em&gt;variance&lt;/em&gt; an unbiased estimator of population variance, taking the square root generally leaves the sample standard deviation biased. These estimator statements assume independent identically distributed observations with finite variance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mistake 3: Automatically deleting outliers.&lt;/strong&gt; Standard deviation squares deviations, making it sensitive to extreme values. A single unusually large data point deserves careful investigation to check for recording errors, but it should never be discarded purely because it inflates the spread.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Try it yourself, then check&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 1:&lt;/strong&gt; For the dataset 5, 5, 5, 5, what is the population standard deviation?
&lt;strong&gt;Answer:&lt;/strong&gt; 0. Because every observation equals the mean (5), every deviation is 0. The squared sum is 0, making both variance and standard deviation 0. There is zero dispersion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 2:&lt;/strong&gt; If every observation in a dataset is multiplied by 3, how does the population standard deviation change?
&lt;strong&gt;Answer:&lt;/strong&gt; It is multiplied by 3. Scaling every data point stretches the entire distribution outward by a factor of 3, scaling all distances (and thus the standard deviation) proportionally. (Variance, being squared, would increase by a factor of 3^2 = 9).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exercise 3:&lt;/strong&gt; You calculate a sample variance of 16 for a dataset of size n = 9. What is the sample standard deviation?
&lt;strong&gt;Answer:&lt;/strong&gt; 4. The sample standard deviation is simply the square root of the sample variance (√(16) = 4). The sample size n = 9 was extra background information not needed to take that square root.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Further study: &lt;a href="https://openstax.org/books/introductory-statistics-2e/pages/index" rel="noopener noreferrer"&gt;the linked open learning reference&lt;/a&gt;. The examples above are original teaching examples.&lt;/p&gt;

&lt;p&gt;We are building Matheria for calculation, organized study, and learning resources. &lt;a href="https://matheria.app/?utm_source=dev&amp;amp;utm_medium=article&amp;amp;utm_campaign=student_questions_20&amp;amp;utm_content=standard-deviation" rel="noopener noreferrer"&gt;Explore Matheria&lt;/a&gt;. Which step should we explain in a follow-up? Leave a specific question.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Editorial note: Prepared with AI assistance and discussed with Gemini before publication. Student scenes and datasets are fictional unless stated otherwise. The cover is AI-generated conceptual artwork, not experimental evidence.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Python reference: &lt;a href="https://docs.python.org/3/library/statistics.html" rel="noopener noreferrer"&gt;https://docs.python.org/3/library/statistics.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a Matheria Study adaptation of our math series, prepared with AI/Gemini assistance and independently checked. The code above was run locally.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>computerscience</category>
      <category>programming</category>
      <category>python</category>
    </item>
  </channel>
</rss>
