For a finite constraint satisfaction problem, remove values violating unary restrictions before starting. The following backtracking algorithm makes independent copies of constraint domains at each branch, so failed forward checking cannot contaminate a sibling branch.
SOLVE(P):
    D := domains of P after unary filtering
    if some D[X] is empty: return failure
    return SEARCH({}, D)

SEARCH(assignment, D):
    if every variable is assigned: return assignment
    X := SELECT-UNASSIGNED-VARIABLE(assignment, D, P)
    for v in ORDER-DOMAIN-VALUES(X, assignment, D, P):
        if X=v is compatible with the current assignment:
            next_assignment := assignment extended by X=v
            next_domains := a deep copy of D
            next_domains[X] := {v}
            if INFERENCES(X, v, next_assignment, next_domains, P) succeeds:
                result := SEARCH(next_assignment, next_domains)
                if result is not failure: return result
    return failure
SELECT-UNASSIGNED-VARIABLE implements minimum remaining values: choose an unassigned variable with the smallest current constraint domain. Break ties by the degree heuristic, choosing the variable constrained to the greatest number of other unassigned variables; a fixed final tie rule makes execution reproducible. ORDER-DOMAIN-VALUES may use any complete ordering; ascending values suffice here.
INFERENCES implements forward checking: for each unassigned neighbor of , remove every value incompatible with , and fail if any constraint domain becomes empty. For higher-arity constraints, reject any completely instantiated violation and use a sound chosen filtering rule; the stated neighbor test is the usual binary case. Forward checking never removes a value used by a possible extension of the current assignment. Exhausting every surviving value therefore makes this finite backtracking procedure both sound and complete.[ref][ref]
Cutset conditioning selects a cycle cutset : deleting its vertices makes the binary constraint graph a forest. Enumerate assignments to , reject those violating internal constraints, and filter each remaining constraint domain against the chosen cutset values. Solve the residual components by tree-structured constraint satisfaction. Stop at a successful assignment, or report failure after all cutset assignments fail. Completeness follows by considering the restriction of any full solution to ; soundness follows by checking internal, crossing and residual constraints. With maximum constraint domain size and cutset variables, a typical bound is for the residual forest work, with cutset and crossing checks added explicitly.[ref]
Here take . The residual constraint graph has vertices and only edges , a tree rooted at . Choose the consistent cutset values . Filtering against these assignments gives
The upward support pass from deletes , because can only equal . The pass from retains , which has support or . Assign at the root and then supported child values . Together with , this gives the solution in (c).
No singleton cycle cutset exists: deleting or leaves, respectively, a triangle on or ; deleting leaves the cycle in a graph . Thus the two-element choice is also minimum, although the algorithm only requires a valid cutset.
Use AND-OR search for a strong plan. At an OR node choose a joint action; at its AND node require successful continuations for every possible outcome. A repeated state on the current branch cannot by itself establish progress. On a finite state space, the equivalent strong planning winning-set iteration starts with and repeatedly adds states with an action whose nonempty outcome set is contained in the current winning set:
A newly admitted state has a plan with at most remaining steps in the worst case. This algorithm terminates on the finite state space and is complete for finite guaranteed-success plans. In a general nondeterministic planning problem it cannot guarantee that a strong plan exists: an uncontrollable self-loop can prevent inevitable progress.
For this particular unobstructed grid, a strong plan does exist. Command Mr Robot to wait throughout and move Mrs Robot along a shortest route to his initial room. Her movement is deterministic and his waiting is unaffected by the horizontal uncertainty. This meets in steps, regardless of every uncertain outcome, because no uncertain command is used. Thus a complete finite AND-OR search will find a solution here. With an unspecified disconnected maze, existence would instead require both robots to lie in the same reachable graph component.
The residual constraint graph is a tree, rooted conveniently at , with children and with a child of . Solve it by the tree-structured constraint satisfaction algorithm: enforce arc consistency from children toward their parents, then choose a surviving root value and select supported child values in the opposite direction.
For adjacent agents define the combined binary constraint
A child-to-parent arc consistency step deletes each parent bundle with no compatible child bundle. Process the edges in the order , , , .
First, needs a nonempty subset of . Supporting reduces 's constraint domain to
Indeed, leaves only for but gives value ; and leave no possible item for . Each of the four retained choices has a compatible choice for .
Next, supporting reduces 's constraint domain to all nonempty subsets of . To see why item cannot remain in 's bundle, a disjoint compatible bundle from would have to be , but then values its own bundle at and 's at least at . Conversely any nonempty subset of is compatible with .
Supporting next reduces 's constraint domain to
If held item , disjointness would force , whose value is below 's value for 's bundle. If holds but not , then , and needs value at least to avoid envying . If holds neither, supports every nonempty subset of .
Finally, supporting leaves
The removed choices contained both and , leaving no item for . Every displayed choice has a compatible choice for .
Choose , then supported child values, giving
Items remain unallocated, which this variant expressly permits. To check every envy-free allocation inequality, the matrix of agents' additive valuations of these bundles, with rows and columns both ordered , is
Each diagonal entry is at least every entry in its row. The bundles are nonempty, pairwise disjoint, and contain only positively valued items, so all remaining requirements hold.
Why does selecting supported children suffice? The residual constraint graph has no graph cycle, so different child subtrees have no constraints between them. Child-to-parent arc consistency has already ensured a compatible continuation below every retained parent value. Applying this observation recursively proves that the downward choices complete a solution without backtracking. With variables and maximum constraint domain size , the basic compatibility checks require time complexity in Big O notation, counting each binary constraint evaluation as one operation; evaluating bundle sums has its own input-dependent cost.
There is no convincing single birthplace of science unless the definition is narrowed in advance. Systematic astronomy and mathematics preceded classical Greece; Greek natural philosophy developed distinctive explanatory and demonstrative ambitions; early modern Europe transformed the relationship between mathematics, experiment and institutions. These are different historical achievements. Treating any one of them as the creation of everything now called science confuses a particular form of inquiry with inquiry's entire history.
A good test begins with surviving practices rather than a list of supposed founding geniuses. The Babylonian astronomical diary VAT 4956 records positions of the Moon and planets relative to named stars, together with other observations, for 568–567 BCE. Such a record requires trained observers, a conventional vocabulary and a means of accumulating observations over time. Its intellectual value is not annulled because astronomy was entangled with divination and royal administration. However, this particular diary should not be credited with everything achieved by later Babylonian predictive astronomy: an observational record is evidence of systematic recording, not by itself evidence of a particular predictive algorithm.[ref]
Egyptian mathematics provides a different kind of evidence. Problem 50 of the Rhind mathematical papyrus gives a procedure for the area of a circular field: remove one ninth of its diameter and square the remainder. Written in modern algebraic notation, the procedure is
Comparing this with the modern circle formula gives the effective approximation . This is our reconstruction of the rule's accuracy, not a claim that its author used our symbol or formulated an abstract theory of that constant. A worked numerical procedure is mathematical knowledge even when it is not presented as a Greek-style proof.[ref]
The case for Greece therefore needs a more specific claim. In Physics by Aristotle, nature is investigated through principles of motion and change, and explanation requires identifying different kinds of cause. His distinctions between material, formal, moving and final causes constitute an explicit programme of explanation, not merely a collection of useful recipes. Greek mathematics, exemplified by Euclid's Elements, made the organization of results into chains of proof unusually prominent. These traditions help explain why later European scholars gave Greek texts such authority. They do not establish that earlier or non-Greek practitioners lacked reasoning, nor that all Greek explanations were correct.[ref][ref]
The European sixteenth and seventeenth centuries nevertheless deserve attention as more than the recovery of ancient truths. Galileo Galilei's Two New Sciences by Galileo Galilei joins precise definitions of motion to geometrical demonstrations and reported tests. An inclined plane lengthens a descent sufficiently to compare its distance and time; a mathematical dependence becomes something an apparatus can discriminate. Francis Bacon's Novum Organum by Francis Bacon instead urges a disciplined reconstruction of inquiry through ordered experience and the correction of intellectual prejudices. Their programmes differ, but both show participants deliberately contesting how knowledge should be made. Neither text authorizes the claim that observation or reasoning had only just been invented.[ref][ref]
Institutional criteria also change the answer. If science means a modern profession with specialized laboratories, credentials and journals, even sixteenth-century Europe is too early for much of it. If it means any successful craft technique, the category becomes so broad that the first surviving written text cannot identify its beginning. If it means public, revisable claims about nature supported by disciplined observation and reasoning, several ancient traditions qualify, with different strengths and social settings. Each definition selects different evidence; none should be smuggled into a geographical verdict.
The strongest conclusion is consequently plural but discriminating. Greece was a major centre of explanatory natural philosophy and demonstrative mathematics; early modern Europe was a major site of their reorganization; neither was the unique beginning of systematic knowledge of nature. This conclusion recognizes real differences in standards of explanation without using proximity to present-day science as the sole measure of past achievement. It also leaves open the historical work of tracing transmission and transformation rather than imagining isolated civilizations independently possessing, or wholly lacking, a timeless scientific essence.
For , write , and let count the connected components of , including isolated vertices. A maximal forest in each component has one fewer edge than vertices, so . The required forest polytope is
We prove both inclusions, using the matroid independence polytope argument explicitly.
If is a forest, is an independent subset of , so . Its indicator is nonnegative. All convex combinations of these indicators therefore lie in .
For the converse, take any real objective vector . List just its positive-weight edges as with , put , and set . Run the forest greedy algorithm on these edges and call the output . At every prefix, the accepted edges form a maximal forest of , so
Indeed a previously rejected edge still has its endpoints joined later; therefore no rejected prefix edge can augment the chosen forest. A maximal forest spans every prefix component and has the stated size.
For every , dropping nonpositive objective terms and telescoping now gives
The last equality uses the same telescoping identity for the greedy indicator. If there are no positive coefficients, the empty forest attains the bound zero. Thus every linear objective over is maximized by a forest indicator.
The singleton inequalities give , so is compact. The convex hull of the finitely many forest indicators is also compact. If some were outside , the finite-dimensional separating hyperplane theorem would give with , contradicting the bound just proved. Therefore , completing the convex-hull proof.
An equivalent system indexed by vertex sets is
where contains all edges with both ends in . The rank system implies this since . Conversely, split any edge set into its vertex components . Nonnegativity and the vertex inequalities give . Hence this second system describes the same polytope.
Let item have weight and profit . Define as the largest profit obtainable from the first items with capacity at most the nonnegative integer . Set . The last item is either absent or present once, giving the dynamic programming recursion
The two alternatives exhaust the feasible binary decisions. In the second alternative, deleting item leaves exactly the smaller subproblem with capacity , which proves the recurrence.
Fill rows , and within each row capacities . Store which alternative attains each maximum. Backtrack from : when exclusion was chosen, set and move to ; when inclusion was chosen, set and move to . Ties may be resolved either way. Thus the stored values yield an actual optimal selection, not just its objective value.
For items and capacity , the algorithm uses arithmetic operations and space with the full backtracking table. It is a pseudo-polynomial algorithm, since is a numerical capacity rather than its bit length. A value-only version can use one row, but must update capacities in decreasing order to avoid reusing the same item.
For tetrahedra, a normal surface has a vector counting four triangle types and three quadrilateral types in each tetrahedron. On every glued face, the numbers of arcs of each of its three types must agree on the two sides. These give homogeneous integer linear equations
For closed surfaces the coordinates of disks meeting an unglued boundary face must also vanish. The nonnegativity and matching equations are not the whole admissibility condition: in each tetrahedron at most one of its three quadrilateral coordinates can be nonzero. Conversely, for an admissible vector, arrange the prescribed parallel disks and glue their face arcs in order. This reconstructs an embedded normal surface, unique up to normal isotopy.
A fundamental normal surface corresponds to a nonzero admissible vector which cannot be written as with both and nonzero admissible vectors. These indecomposable vectors form a fundamental set: every admissible vector is their finite sum. To find them, fix which quadrilateral type is allowed in each tetrahedron. This leaves the integer points of a rational polyhedral cone , with some coordinates set to zero. Compute its Hilbert basis of a rational cone, for example by subdividing into rational simplicial cones and enumerating the lattice points in their fundamental parallelepipeds along with their integral ray generators, then removing decomposable generators. Repeat the finite list of quadrilateral choices, remove duplicates, and remove vectors decomposable in their compatible sector. Finiteness follows because each of these pointed rational cones has a finite Hilbert basis.
Let be the link exterior. By Alexander duality, for a two-component link
An embedded connected closed surface separates ; its mod-two class is nonzero exactly when the two link components lie on different sides. The connectedness qualification matters: two parallel splitting spheres form a disconnected surface with zero total class. We use the criterion only for connected surfaces.
Normalize a splitting sphere by isotopy, disk compressions and removal of components lying inside tetrahedra. A compression replaces a sphere by two spheres whose mod-two classes add to the old class; at least one is still a splitting sphere. The discarded tetrahedral spheres have zero class. Thus there is a normal splitting sphere. Choose one, , of least normal surface weight.
Suppose its vector is decomposable. Realize as a Haken sum, choosing a decomposition with the least possible number of intersection curves. Two elementary exchange observations are useful. First, and can be taken connected. If their total union has more than two components, perform regular exchanges connecting components until exactly two embedded groups remain, resolving any intersections within each group. Since the final sum is connected, this can be done before the last joining exchange; it uses up at least one of the old intersection curves. The resulting two normal surfaces still have total vector , contradicting minimality. Second, no intersection curve separates both and . If it did, resolve that curve first: the two separated sides give two groups. Resolve any remaining self-intersections within each group and continue exchanges between groups only while the result remains disconnected. Just before the exchange making the final connected surface, there are again exactly two embedded normal groups with fewer intersection curves. Both assertions follow from the local four-bank resolution at an intersection circle; internal crossings are resolved before regarding a group as one embedded summand.
Every closed embedded surface in is orientable. Additivity of Euler characteristic in the Haken sum gives
For connected orientable closed surfaces the positive Euler characteristic is , and the only zero Euler characteristic is that of a torus. Thus one summand, say , is a sphere and the other is a torus. Both have smaller weight than . The sphere cannot split the link by minimality, so
Each intersection circle separates the sphere , so the second exchange observation makes it nonseparating on . In particular, these circles are essential parallel curves on the torus.
Cut along the intersection circles. There are at least two innermost disk patches. Choose one of smallest weight, ; then . Its interior misses , and its boundary is essential on . Compress the torus along two slightly separated copies of . The result is a sphere , and the compression takes place in the exterior, so
Thus is a splitting sphere.
This alone is not quite a contradiction if the last weight inequality is equality: need not yet be normal. At the compression seam it uses the alternative, rather than regular, exchange between the disk patch and the torus. An intersection circle of normal disk sheets must cross a tetrahedral face; it cannot be a closed curve entirely in two disk interiors in one tetrahedron, which can be put in standard position with only intersection arcs. In a face, parallel arcs of the same type do not cross. At a crossing of different normal arc types, the alternative exchange joins two endpoints on the same edge, producing a returning arc. Pushing across its edge bigon strictly reduces weight. Normalize the resulting surface, retaining a nonzero-class sphere at each compression as before. We obtain a normal splitting sphere of weight strictly less than , a contradiction. Therefore
The algorithm is now finite. Triangulate the exterior from a link diagram, enumerate its fundamental admissible vectors with the closed-surface boundary condition, reconstruct their surfaces, and inspect the connected components and Euler characteristics. A fundamental vector yields a connected surface, since otherwise its component vectors decompose it. A connected closed surface in with Euler characteristic two is a sphere. Compute its mod-two class in the finite simplicial chain complex, or equivalently check which link boundary tori lie on either side. Answer yes exactly when such a sphere has nonzero class. The argument proves that every split link is detected, and every detected sphere witnesses splitting. For more than two components, and a nonzero sphere class separates a nonempty proper subset of the components; the same least-weight argument and finite enumeration apply.
A linear polyhedron is full-dimensional if its affine hull is . For a convex set, this is equivalent to containing an open Euclidean ball: an open ball has full affine span, while affinely independent points in the set span a simplex with nonempty interior. In particular, a nonempty linear polyhedron need not be full-dimensional; a singleton or a hyperplane is an example.
Assume , increasing the coefficient bound to one if necessary. If and denotes the th row, then . For and , the Cauchy-Schwarz inequality gives
Thus with , proving that is a full-dimensional linear polyhedron. This part works for every positive ; the particular small value also ensures that relaxation cannot create feasibility when is empty.
Here is that exact-feasibility point. Put . If is empty, a Farkas certificate for linear inequalities gives with and . Normalize , and maximize over the compact linear polyhedron
Choose a maximizing extreme point. Its positive support has size : a dependence among its supported columns would permit small perturbations of both signs in , contradicting extremality. Select independent equations for those coordinates. Cramer's rule expresses them over a common nonzero integer determinant , with . Since is integer and , its numerator is a positive integer after choosing a positive denominator. Hence . This is the normalized integer Farkas infeasibility gap. A point in would imply
a contradiction. Consequently if and only if .
The ellipsoid method takes the integer matrix , vector , dimension , and a bound (or their binary encodings). It computes the prescribed , an inner radius , and an outer radius whose logarithms have polynomial size. For an explicit outer bound, let . A nonempty has a rational feasibility certificate for integer inequalities with . To see this bound, intersect with an orthant containing a feasible point. This intersection is a nonempty linear polyhedron containing no whole nontrivial affine line, and it has an extreme point. Indeed, if its active rows do not yet span the ambient space, move along a nonzero direction annihilating them. The orthant prevents motion in both directions from being feasible forever, so in at least one direction a new independent row becomes active. Repeating at most times produces an extreme point. At that point choose independent active constraints, including coordinate constraints where needed. Cramer's rule and the Hadamard determinant inequality bound the numerators by , while a nonzero integer denominator has absolute value at least one. Thus the point has norm at most . Choosing ensures that, whenever is nonempty, an entire radius- Euclidean ball in lies inside .
Start with the ellipsoid and retain . At each iteration test the centre against every relaxed inequality. If it passes all tests, is nonempty and hence so is . Otherwise a violated row gives the separation oracle: the feasible set lies in . Cut the current ellipsoid by this half-space through its centre and replace it by the standard containing ellipsoid. Every step retains and, for , reduces Lebesgue measure by a factor at most . In dimension one the corresponding step bisects an interval.
If more than cuts occur without finding a feasible centre, the Lebesgue measure is smaller than that of a radius- ball. This contradicts the retained ball whenever is nonempty, so the algorithm can declare empty. Both and are polynomial in and , and each inequality test uses arithmetic operations for rows. The bit implementation uses rational rounding with outward enlargement of the containing ellipsoids; the encoding bounds allow polynomial precision while keeping a constant fraction of the volume decrease. Detailed update and rounding formulae are not needed for this account. The essential role of the full-dimensional relaxation of integer inequalities is to supply a positive inner-volume bound without changing the emptiness decision; applying a Lebesgue measure stopping test directly to a lower-dimensional would fail.
An algorithm is a finite effective procedure on finitely encoded inputs; a Turing machine is one precise model. A decision algorithm must halt on every permitted input and answer correctly. An algorithmic problem specifies the input encoding and the required output; enumerating positive answers alone is not a decision algorithm.
For a fixed finite group presentation , the word problem for a group takes a finite word in and asks whether it represents the identity. Equality of two represented elements is equivalent to testing . Positive answers are recursively enumerable: enumerate finite products of conjugates of relators and their inverses, freely reduce them, and compare with the input. Equivalently enumerate finite labelled disc diagrams. The van Kampen lemma ensures that every null word eventually appears. For a non-null word this search continues forever. Solvability requires a procedure that also terminates with a negative answer.
First construct the bounded-difference automaton. Fix as above, enlarging it if necessary. Its states are the finitely many elements , together with a reject state and finite flags recording when padding has started on each tape. The initial state is . Read the pair of words synchronously, padding their ends with a symbol representing the identity. If the current prefixes represent , the difference state is . A letter pair updates it by
Reject if the new difference lies outside ; padding must occur only in the final suffix of a tape. The accepting state for the generator is . Induction on the prefix length proves that the machine accepts exactly the padded pairs whose prefix differences stay bounded by and whose final difference is . In particular it correctly recognizes multiplication by for any pair of the chosen combing representatives with adjacent endpoints. Taking accepting state gives the equality machine.
If the combing formal language is regular, take the product with its two word acceptors. These are the usual group multiplier automata, accepting exactly with . From a known representative , a finite-state automaton search with its first tape fixed finds a representative of : existence is guaranteed, so the breadth-first search terminates. Equality is tested by the identity multiplier. Starting with a representative of , repeat these operations over the generators, identifying equal vertices, to build any prescribed finite-radius region of the Cayley graph and all its generator-labelled edges. Iterating multiplication over an input word and testing equality with the identity gives a word problem algorithm.
A bare geometric combing does not imply that is a regular language. Nor can a finite-state automaton recognize the indicated endpoint relation on all words without any restriction: in , which has its usual geodesic synchronous combing, fixing the second word to would make the multiplier for recognize precisely the first words equal to the identity. Intersecting those words with gives , a nonregular language: pumping the initial block changes its exponent without changing the inverse block, contradicting acceptance of precisely the equal exponents. Thus the literal unrestricted-pair request is false; the machines above recognize bounded fellow-travelling pairs, or full representative-pair relations under the additional automatic-language hypothesis.
Nevertheless the final decidability assertion is true for a synchronous combable group, without a regular-language assumption. Here is a terminating filling bound, avoiding any assumption that the given combing is computable. Let be the number of words of length at most over . A horizontal row of the diagram in part (ii) is encoded by its ordered rung words, so there are at most possible row types. If two rows have the same word tuple, delete the band between them and identify corresponding labelled rungs. This preserves the outside boundary and leaves a valid diagram of the same short relators. Equivalently, the first column is always at , so identical rung tuples describe the same vertex configuration. Repeatedly remove such bands. At most distinct rows remain, with at most short-relator cells per layer.
This finite-state row shortening of a combing diagram gives the recursive bound . For the given finite group presentation, every short identity in the finite set has some fixed diagram over its defining relators. Let bound their areas. Replacing each short face by its fixed diagram gives
Part 3(ii) now supplies a terminating word decider. This also constructs finite Cayley graph regions for a nonregular combing: enumerate words of bounded length, use the decider on to identify vertices, and use it on to determine the generator edges. The finite ball and transition table of the bounded-difference machines can consequently be computed. The constants depend on a fixed combing and are not a uniform procedure certifying combability of an arbitrary input group presentation. Every finite group presentation of this synchronous combable group has solvable word problem, by the presentation-invariance proof in Q3.
Take an integer bounding synchronous distances at integer times. Let be all words over of length at most that represent the identity in . This is a finite set. We claim that presents , interpreting inverse letters in the usual way.
To prove it, let be any null word and let , with . Draw the combing paths as vertical columns, completed paths being padded by stationary steps. At each integer height join consecutive columns by a rung labelled by a word of length at most representing their displacement. At the bottom choose empty rungs, and at a common final height choose the actual boundary letters as rungs.
Every elementary strip cell has two rungs of length at most and two vertical steps of length at most one. Its boundary word has length at most and is null in , because the four paths close in the actual Cayley graph. It is therefore a relator in . Gluing all cells fills the top loop : the bottom row and the two copies of the identity column collapse to the basepoint. Thus every null word is a product of conjugates of these finitely many short relators. The reverse containment holds because each relator is already an identity in .
Hence the finite presentation from a synchronous combing proves
This is an existence proof of a finite relator set. It does not assume an algorithm for identifying identities in an arbitrary group presentation before establishing decidability.
P is the class of decision problems decided by a deterministic algorithm in time polynomial in the encoded input length. NP is the class whose yes-instances have complexity certificates of polynomial length that a deterministic algorithm verifies in polynomial time.
A decision problem is NP-complete if it belongs to NP and is NP-hard: every problem in NP admits a polynomial-time many-one reduction to it. Such a reduction maps an instance to an instance in polynomial time and satisfies is a yes-instance if and only if is a yes-instance. Membership in NP and NP-hardness are both required.
For an explicit algorithm, keep an unnormalized residual , initially , whose row and column sums all equal a common mass , initially one. While , find a perfect matching in its positive support, form its permutation matrix , and subtract , where is the smallest selected entry. Record and replace by .
If the residual mass is positive, the same proof of the Hall marriage theorem condition applies after division by . Every subtraction removes at least one positive entry and creates no new positive entries. Before the last subtraction, any positive-mass residual has at least positive entries; the last step removes all its entries. If is the initial number of positive entries, then
Since the residual ultimately vanishes, summing the recorded subtractions gives , and the row sums give .
A perfect matching can be found by at most searches for an augmenting path in a matching, each costing in a graph with at most edges. Thus each iteration costs , including forming the support and updating the residual, and there are iterations. Hence
This bound uses exact real arithmetic. For rational input, a common denominator lets all residual subtractions be performed on integers of polynomial bit length, giving a polynomial bit-time implementation as well.
At step , choose a real shift , factor , and set
The last equality proves orthogonal similarity at every step. Thus all iterates have the same eigenvalues; if is symmetric, the last expression is symmetric, proving symmetry by induction.
For the specified matrix, let . Then and , so and . It is a Householder reflection, hence orthogonal. With the standard positive-diagonal QR convention, part (a) gives , at the first unshifted step, and therefore . The same repeats forever: the unshifted algorithm is stationary.
If arbitrary diagonal signs in QR are allowed, , for a sign matrix , and the next iterate is . Its off-diagonal magnitudes are unchanged, so even then only sign changes occur, not progress toward a diagonal form. This explains the role of the usual convention in the literal stationary-iterate statement.
At , the derivative and curvature are , , so the next iterate is . At , they are , , so the next iterate is . Hence
The undamped algorithm does not converge to a minimum; it has an exact two-cycle. The implementation in (iii) detects this after returning to one and reports failure. This example illustrates why the local convergence result in (ii) does not justify global success.
Computational complexity theory studies the resources needed by an algorithm as a function of input size, after specifying the resource and computational model. For example, time complexity may count comparisons, and space complexity may count stored words. Worst-case time complexity is the greatest cost among inputs of size ; best-case and average costs are different measures.
An upper bound guarantees that a cost is no greater than the stated bound. A lower bound guarantees that it is no smaller. For a problem, an algorithm can establish an upper bound on what is achievable, while a problem lower bound must apply to every eligible algorithm in the chosen model. Bounds need not be tight. Concisely,
Use the DAG shortest-path algorithm: first compute a topological ordering, then perform edge relaxation once for every edge in that order. Store a shortest-path predecessor when a distance improves so that the actual paths, as well as their costs, can be recovered.
order := a topological ordering of V;
FOR each vertex v DO d[v] := infinity; pred[v] := NIL END;
d[source] := 0;
FOR u in order DO
  IF d[u] <> infinity THEN
    FOR each edge (u,v) with cost w DO
      IF d[u] + w < d[v] THEN
        d[v] := d[u] + w; pred[v] := u
      END
    END
  END
END
Each loop has a natural invariant. During initialization, all vertices already processed have infinite distance and no predecessor. During the outer relaxation loop, all processed vertices have their final shortest-path distances, and every edge leaving a processed vertex has been relaxed. During an inner edge loop, the outgoing edges of u already inspected have been relaxed using its final distance, while the outer invariant remains true for all earlier vertices.
For correctness, every path to a vertex ends with an edge from an earlier vertex in the topological ordering. When is reached, all those earlier distances are correct and all incoming edges have been relaxed. Therefore
with infinite distance for unreachable vertices and the empty path included at the source. No directed path can return to the source in a Directed acyclic graph. Induction over the topological ordering proves all distances correct. Following predecessor links backward reconstructs each reachable shortest path.
With adjacency lists, topological sorting takes time and the relaxation pass has the same bound, using extra space beyond the input. Thus the full distance and predecessor representation costs time. Printing every source-to-vertex path separately can take more time because their total output length may be quadratic. The stipulated nonnegative costs are sufficient; this algorithm actually also permits negative costs because there are no directed graph cycles.
Interpret the source's as the maximum finite shortest-path distance among reachable pairs, taking when only length-zero graph paths are needed. This is the length bound required for reflexive transitive closure. A directed graph cycle permits arbitrarily long walks, so the maximum length of all possible walks would not be a finite termination parameter.[ref]
For the elementary dense implementation, each Boolean matrix multiplication evaluates all triples , with no early exit. Each equality test costs . Starting from , the algorithm reaches after updates when , then performs one further update to detect stability. Consequently, for ,
For the usual nontrivial case , this is . Since , the overall worst case is . This bound is tight for this implementation: the directed chain has and gains previously unknown pairs at every length until then, while every update scans all triples. This tightness does not claim an inherent lower bound for the reflexive transitive closure problem; it concerns the specified repeated-extension algorithm.
Restrict attention to distinct keys; any comparison sort must handle these inputs. A deterministic comparison sort can be represented by a binary decision tree: an internal node records a comparison and its two possible outcomes, and a leaf records the final ordering of the input positions.
There are possible relative orders. Two different orders cannot finish at the same leaf, since the algorithm would then output the same ordering of positions for both, making at least one result incorrect. A binary decision tree of height has at most leaves. Hence
Using the given bound, or just the last factors of , gives
This is a worst-case comparison sorting lower bound, and merge sort achieves the same order. The result concerns comparison sorting; a procedure that uses numerical digits or bounded integer values has a different computational model.