ArticleslgStudy

mathematics

Partition problem

Partition problem is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Partition problem rather than just read about it. In short: In number theory and computer science, the partition problem, or number partitioning, is the task of deciding whether a given multiset S of positive integers can be partitioned into two subsets S1 and S2 such that the sum of the numbers in S1 equals the sum of the numbers in S2. Although the partition problem is NP-complete, there is a pseudo-polynomial time dynamic programming solution, and there are heuristics tha…

Key takeaways

  • Partition problem belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Partition problem to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Partition problem from memory before moving on to harder problems.

Reference excerpt

In number theory and computer science, the partition problem, or number partitioning, is the task of deciding whether a given multiset S of positive integers can be partitioned into two subsets S1 and S2 such that the sum of the numbers in S1 equals the sum of the numbers in S2. Although the partition problem is NP-complete, there is a pseudo-polynomial time dynamic programming solution, and there are heuristics that solve the problem in many instances, either optimally or approximately. For this reason, it has been called "the easiest hard problem". There is an optimization version of the partition problem, which is to partition the multiset S into two subsets S1, S2 such that the difference between the sum of elements in S1 and the sum of elements in S2 is minimized. The optimization version is NP-hard, but can be solved efficiently in practice. The partition problem is a special case of two related problems:

In the subset sum problem, the goal is to find a subset of S whose sum is a certain target number T given as input (the partition problem is the special case in which T is half the sum of S). In multiway number partitioning, there is an integer parameter k, and the goal is to decide whether S can be partitioned into k subsets of equal sum (the partition problem is the special case in which k = 2). However, it is quite different to the 3-partition problem: in that problem, the number of subsets is not fixed in advance – it should be |S|/3, where each subset must have exactly 3 elements. 3-partition is much harder than partition – it has no pseudo-polynomial time algorithm unless P = NP.

Examples Given S = {3,1,1,2,2,1}, a valid solution to the partition problem is the two sets S1 = {1,1,1,2} and S2 = {2,3}. Both sets sum to 5, and they partition S. This solution is not unique. S1 = {3,1,1} and S2 = {2,2,1} is another solution. Not every multiset of positive integers has a partition into two subsets with equal sum. An example of such a set is S = {2,5}.

Computational hardness The partition problem is NP hard. This can be proved by reduction from the subset sum problem. An instance of SubsetSum consists of a set S of positive integers and a target sum T; the goal is to decide if there is a subset of S with sum exactly T. Given such an instance, construct an instance of Partition in which the input set contains the original set plus two elements: z1 and z2, with z1 = sum(S) and z2 = 2T. The sum of this input set is sum(S) + z1 + z2 = 2 sum(S) + 2T, so the target sum for Partition is sum(S) + T.

Suppose there exists a solution S′ to the SubsetSum instance. Then sum(S′) = T, so sum(S′ ∪ z1) = sum(S) + T, so S′ ∪ z1 is a solution to the Partition instance. Conversely, suppose there exists a solution S′′ to the Partition instance. Then, S′′ must contain either z1 or z2, but not both, since their sum is more than sum(S) + T. If S'' contains z1, then it must contain elements from S with a sum of exactly T, so S'' minus z1 is a solution to the SubsetSum instance. If S'' contains z2, then it must contain elements from S with a sum of exactly sum(S) − T, so the other objects in S are a solution to the SubsetSum instance.

Approximation algorithms As mentioned above, the partition problem is a special case of multiway-partitioning and of subset-sum. Therefore, it can be solved by algorithms developed for each of these problems. Algorithms developed for multiway number partitioning include:

Greedy number partitioning – loops over the numbers, and puts each number in the set whose current sum is smallest. If the numbers are not sorted, then the runtime is O(n) and the approximation ratio is at most 3/2 ("approximation ratio" means the larger sum in the algorithm output, divided by the larger sum in an optimal partition). Sorting the numbers increases the runtime to O(n log n) and improves the approximation ratio to 7/6. If the numbers are distributed uniformly in [0,1], then the approximation ratio is at most 1+O(log⁡log⁡nn) almost surely, and 1+O(1n) in expectation. Largest Differencing Method (also called the Karmarkar–Karp algorithm) sorts the numbers in descending order and repeatedly replaces numbers by their differences. The runtime complexity is O(n log n). In the worst case, its approximation ratio is similar – at most 7/6. However, in the average case it performs much better than the greedy algorithm: when numbers are distributed uniformly in [0,1], its approximation ratio is at most 1+1/nΘ(log⁡n) in expectation. It also performs better in simulation experiments. The multifit algorithm uses binary search combined with an algorithm for bin packing. In the worst case, its approximation ratio is 8/7. The subset sum problem has an FPTAS which can be used for the partition problem as well, by setting the target sum to sum(S)/2.

Exact algorithms There are exact algorithms, that always find the optimal partition. Since the problem is NP-hard, such algorithms might take exponential time in general, but may be practically usable in certain cases. Algorithms developed for multiway number partitioning include:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Partition problem

Start with the simplest possible case. Write down what Partition problem claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Partition problem before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Partition problem ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Partition problem

In research
Partition problem appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Partition problem in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Partition problem is common in secondary-school and first-year university syllabi. It links to neighbouring topics Number partitioning, Weakly NP-complete problems, so understanding it makes those chapters shorter.
In everyday life
Look for Partition problem outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Partition problem” →

How to study Partition problem in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Partition problem means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Partition problem out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Partition problem in simple terms?

In number theory and computer science, the partition problem, or number partitioning, is the task of deciding whether a given multiset S of positive integers can be partitioned into two subsets S1 and S2 such that the sum of the numbers in S1 equals the sum of the numbers in S2. Although the partit…

Why does Partition problem matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Partition problem?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Partition problem.

Tags

  • Number partitioning
  • Weakly NP-complete problems

Keep exploring