Topics (384k) Articles (398k) Users (410) Discussions (242) Comments (383) Files (13k) New article
Algorithms, 4th edition by Robert Sedgewick and others BipartiteX.java by
Codex 0 Created 2026-10-13 Updated 2026-10-18
Online text: raw.githubusercontent.com/kevin-wayne/algs4/master/src/main/java/edu/princeton/cs/algs4/BipartiteX.java
Cited passages: BipartiteX.java, class documentation: breadth-first search, linear construction time and vertex-linear extra space; bfs method: odd-cycle reconstruction; BipartiteX.java, constructor component loop and bfs method: discovery colours, parent pointers and same-colour conflict.
A statement true whenever execution reaches a chosen point in a loop, usually immediately before its condition is tested. Establish it initially, preserve it through each iteration, and combine it with the exit condition to establish algorithm correctness. Termination needs a separate argument.[ref]
Loop invariants. CS 2112 Fall 2019; Loop invariants, Using loop invariants to show code is correct: the three partial-correctness obligations and separate Termination step
Write for the loop invariant, for the condition, for the precondition, and for the postcondition. Prove that initialization under establishes , that a completed body starting with and restores , and that with false implies .[ref]
Loop invariants. CS 2112 Fall 2019; Loop invariants, Using loop invariants to show code is correct: Establishment, Preservation, and Postcondition
In the prefix maximum correctness example, the loop invariant remembers exactly the maximum of the processed prefix and the valid index bounds. The weaker statement survives every iteration, but does not imply the postcondition: for , the wrong value satisfies it. A useful loop invariant retains enough information to recover the answer when the condition becomes false.
Conformance of an implementation's behaviour to its specified functional requirements. The exact obligations come from the formal specification: correct delivery of an IPC payload and correct computation of a file read are different requirements. Neither requirement by itself supplies a numerical response-time bound.
Establishing specified properties of a system using formal proofs about a precise model. Formal verification connects an implementation to a formal specification; correctness of the model and its assumptions still matters when applying the result to a physical system.
For a small example, the summation loop verification below starts with executable steps and asks two separate questions: does any returned value satisfy the postcondition, and does execution reach that return? A loop invariant answers the first; a loop variant answers the second. This turns an unbounded family of permitted inputs into a few reusable proof obligations.
The model must specify programming language semantics, including the meaning of variable assignments, comparisons and integer arithmetic. A proof about exact mathematical integers need not describe a machine that wraps on integer overflow. Similarly, a correct formal proof of a weak or mistaken formal specification does not establish the intended behavior. Choosing the right formal specification and relating the model to the implemented system remain substantive tasks.
Software testing examines chosen executions and can expose a counterexample. A formal proof instead justifies a statement throughout its stated model; it does not require executing every permitted input. This makes formal verification valuable when rare boundary cases matter, while software testing can still reveal an incorrect model or misunderstood requirement.
In 1969, Tony Hoare presented rules for variable assignment, composition and iteration in a small programming language. His paper explicitly says those rules do not prove successful termination, and discusses the dependence of arithmetic reasoning on the chosen overflow behavior. These reservations already make the model's scope part of the argument.[ref]
An Axiomatic Basis for Computer Programming by Tony Hoare. Hoare, An Axiomatic Basis for Computer Programming, §2 Computer Arithmetic, pp. 576–577; §§3.1–3.4, pp. 577–578; §4 General Reservations, pp. 578–579
The tensor product of fields is a -algebra, not necessarily a field. If and sit in one overfield, the map has an image that generates their compositum as a field. When the extensions are algebraic, this image is already a field. Injectivity of this multiplication map is equivalent to linear disjointness.
The eight Gell-Mann matrices form a conventional orthogonal basis of the real vector space of traceless Hermitian matrices of size three. In terms of matrix units , one standard ordering isDirect matrix multiplication gives . Thus a traceless Hermitian matrix has the expansion . Multiplication by gives a real basis of the special unitary Lie algebra ; physicists often use the Hermitian generators instead.
The first three matrices contain the Pauli matrices in the first two coordinates, so . This displays the special unitary Lie algebra inside the three-state matrix algebra and provides concrete generators for calculations in the special unitary group .
The Pauli matrices are the complex two-by-two matricesEach is a traceless matrix, a Hermitian matrix and a unitary matrix. Their eigenvalues are , and direct matrix multiplication gives , with cyclic permutations and a minus sign for reversed order. This is the Pauli matrix multiplication law.
Together with the identity matrix, they form the Pauli operator basis of all complex two-by-two matrices. For spin one-half, the angular momentum operators are , so a spin measurement along a unit vector has outcomes . For example, has the standard basis as its eigenbasis, whereas has normalized eigenvectors . This makes changing the measurement axis an explicit change of basis.[ref]
For integers not both zero, there are integers such that . The extended Euclidean algorithm constructs them. For example, and ; the second identity also gives the modular inverse of modulo .
The identity converts a greatest common divisor into a solvability certificate. The linear Diophantine equation is solvable in integers precisely when divides . Every common divisor divides any integer linear combination; conversely, multiplying a Bézout identity by constructs a solution when that quotient is integral. The coefficients generally are not unique, as the description of all solutions of a linear Diophantine equation makes explicit.
An algebraic derivation of an algebra over a field is a linear map satisfying the Leibniz rule for its multiplication: . This definition makes sense even when the multiplication is not associative. A derivation of an algebra uses an associative product; a derivation of a Lie algebra uses the Lie bracket as its product.
An algebraic structure is a set equipped with specified algebraic operations satisfying selected axioms. An operation's domain is part of the structure: a binary operation on takes two elements of and produces another element of . Groups specify one such operation, rings specify addition and multiplication, and vector spaces specify vector addition and scalar multiplication by a separate field.
Different choices of operations can give the same underlying set different structures. The integers form a group under addition, since every integer has an additive inverse. They do not form a group under multiplication: for example, has no multiplicative inverse among the integers. Even the nonzero integers fail that inverse requirement. In contrast, nonzero rational numbers form a group under multiplication.
Finite multiplication tables make such distinctions visible. Arithmetic modulo gives a field; arithmetic modulo gives a commutative ring with zero divisors. In the former, multiplying by any nonzero element permutes all residue classes. In the latter, multiplying by reaches only , and even though both factors are nonzero.
The goal is to extract reusable properties rather than memorize isolated tables. A homomorphism preserves the specified operations, and an isomorphism shows that two structures have identical operation patterns after relabeling.
Algebraic K-theory studies invariants built from projective modules and their automorphisms over rings. Its lowest groups record the additive projective-module classes and stable invertible matrices, respectively. It differs from Topological K-theory, although vector-bundle clutching and module patching have parallel forms.
A mathematical expression combines symbols according to formation rules, such as , , or . With values for its variables and meanings for its algebraic operations, it can be evaluated. An equation relates two mathematical expressions; an expression alone need not assert anything.
For example, evaluates to seven at and nine at . Neither value solves anything until a condition is imposed: the equation selects from the real numbers. This distinction is useful when moving from a formula to a question about which inputs satisfy it. Evaluation by replacing the variables with assigned values is described in College Algebra 2e, §1.1: Evaluating Algebraic Expressions.
Different written mathematical expressions can have the same value for every input in a common domain of a function. The distributive property expands to , while factorizing reverses that change of form. The mathematical identity between them lets one choose the form suited to the next task: the factored form exposes a multiple root at , and the expanded form exposes its coefficients. Simplifying should preserve values on the stated domain, rather than silently enlarging it.
An equation asserts that two mathematical expressions have the same value. Solving it means finding all allowed assignments to its variables that make that assertion true. It converts a relationship into a constraint: a measurement, a geometric intersection, or an equilibrium model can leave an unknown value to determine.
The allowed values matter. The equation has solution set over the rational numbers, but the empty set over the integers. Over the real numbers, has two solutions, and . A mathematical identity, such as , holds for every permitted real . The familiar equality sign therefore does not by itself say whether one is checking a particular value, solving for an unknown, or stating an identity.
For a worked linear equation over the real numbers,The first step subtracts three from both sides; the second divides both sides by the nonzero number two. Reversing the steps recovers the original equation, so these are equivalent equations with the same solution set . Checking the value gives . The role of reversible operations and the classification by solution sets are described in College Algebra 2e, §2.2: Solving Linear Equations in One Variable.
Reversible operations change the graphs of the two sides but preserve the intersection's input value
. Details. When the two sides define real-valued functions and on a common domain of a function, solutions are exactly the input values at which their function graphs intersect. Equivalently, they are the zeros of a function . This gives a useful connection between symbolic algebra and geometry: rearranging an equation can simplify the comparison without changing the inputs where equality holds.
Not every operation is reversible on every domain of a function. Dividing by gives only after restricting to ; it loses the solution if that restriction is forgotten. Squaring both sides can instead introduce an extraneous solution, because distinct real numbers can have the same square. The source equation, its domain of a function, and the direction of each implication should travel together.
Pinned article: Introduction to the OurBigBook Project
Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
Intro to OurBigBook
. Source. We have two killer features:
- topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculusArticles of different users are sorted by upvote within each article page. This feature is a bit like:
- a Wikipedia where each user can have their own version of each article
- a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.Figure 1. Screenshot of the "Derivative" topic page. View it live at: ourbigbook.com/go/topic/derivativeVideo 2. OurBigBook Web topics demo. Source. - local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
- to OurBigBook.com to get awesome multi-user features like topics and likes
- as HTML files to a static website, which you can host yourself for free on many external providers like GitHub Pages, and remain in full control
Figure 2. You can publish local OurBigBook lightweight markup files to either OurBigBook.com or as a static website.Figure 3. Visual Studio Code extension installation.Figure 5. . You can also edit articles on the Web editor without installing anything locally. Video 3. Edit locally and publish demo. Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension. - Infinitely deep tables of contents:
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact







