text:
Surgery

Surgery is a medical specialty that uses manual and instrumental techniques to diagnose or treat pathological conditions (e.g., trauma, disease, injury, malignancy), to alter bodily functions (i.e., malabsorption created by bariatric surgery such as gastric bypass), to reconstruct or improve aesthetics and appearance (cosmetic surgery), or to remove unwanted tissues (body fat, glands, scars or skin tags) or foreign bodies. The subject receiving the surgery is typically a person (i.e. a patient), but can also be a non-human animal (i.e. veterinary surgery).

The act of performing surgery may be called a surgical procedure or surgical operation, or simply "surgery" or "operation". In this context, the verb "operate" means to perform surgery. The adjective surgical means pertaining to surgery; e.g. surgical instruments, surgical facility or surgical nurse. Most surgical procedures are performed by a pair of operators: a surgeon who is the main operator performing the surgery, and a surgical assistant who provides in-procedure manual assistance during surgery. Modern surgical operations typically require a surgical team that typically consists of the surgeon, the surgical assistant, an anaesthetist (often also complemented by an anaesthetic nurse), a scrub nurse (who handles sterile equipment), a circulating nurse and a surgical technologist, while procedures that mandate cardiopulmonary bypass will also have a perfusionist. All surgical procedures are considered invasive and often require a period of postoperative care (sometimes intensive care) for the patient to recover from the iatrogenic trauma inflicted by the procedure. The duration of surgery can span from several minutes to tens of hours depending on the specialty, the nature of the condition, the target body parts involved and the circumstance of each procedure, but most surgeries are designed to be one-off interventions that are typically not intended as an ongoing or repeated type of treatment.

In British colloquialism, the term "surgery" can also refer to the facility where surgery is performed, or simply the office/clinic of a physician, dentist or veterinarian.

Definitions
As a general rule, a procedure is considered surgical when it involves cutting of a person's tissues or closure of a previously sustained wound. Other procedures that do not necessarily fall under this rubric, such as angioplasty or endoscopy, may be considered surgery if they involve "common" surgical procedure or settings, such as use of antiseptic measures and sterile fields, sedation/anesthesia, proactive hemostasis, typical surgical instruments, suturing or stapling. All forms of surgery are considered invasive procedures; the so-called "noninvasive surgery" ought to be more appropriately called minimally invasive procedures, which usually refers to a procedure that utilize natural orifices (e.g. most urological procedures) or does not penetrate the structure being excised (e.g. endoscopic polyp excision, rubber band ligation, laser eye surgery), are percutaneous (e.g. arthroscopy, catheter ablation, angioplasty and valvuloplasty), or to a radiosurgical procedure (e.g. irradiation of a tumor).

Types of surgery
Surgical procedures are commonly categorized by urgency, type of procedure, body system involved, the degree of invasiveness, and special instrumentation.
 * Based on timing:
 * Elective surgery is done to correct a non-life-threatening condition, and is carried out at the person's convenience, or to the surgeon's and the surgical facility's availability.
 * Semi-elective surgery is one that is better done early to avoid complications or potential deterioration of the patient's condition, but such risk are sufficiently low that the procedure can be postponed for a short period time.
 * Emergency surgery is surgery which must be done without any delay to prevent death or serious disabilities and/or loss of limbs and functions.
 * Based on purpose:
 * Exploratory surgery is performed to establish or aid a diagnosis.
 * Therapeutic surgery is performed to treat a previously diagnosed condition.
 * Curative surgery is a therapeutic procedure done to permanently remove a pathology.
 * Plastic surgery is done to improve a body part's function and/or appearance.
 * Reconstructive plastic surgery is done to improve the function and/or subjective appearance of a damaged or malformed body part.
 * Cosmetic surgery is done to subjectively improve the appearance of an otherwise normal body part.
 * Bariatric surgery is done to assist weight loss when dietary and pharmaceutical methods alone have failed.

 * By type of procedure:
 * Amputation involves removing an entire body part, usually a limb or digit; castration is the amputation of testes; circumcision is the removal of prepuce from the penis or clitoral hood from the clitoris (see female circumcision). Replantation involves reattaching a severed body part.
 * Resection is the removal of all or part of an internal organ and/or connective tissue. A segmental resection specifically removes an independent vascular region of an organ such as a hepatic segment, a bronchopulmonary segment or a renal lobe. Excision is the resection of only part of an organ, tissue or other body part (e.g. skin) without discriminating specific vascular territories. Exenteration is the complete removal of all organs and soft tissue content (especially lymphoid tissues) within a body cavity.
 * Extirpation is the complete excision or surgical destruction of a body part.
 * Ablation is destruction of tissue through the use of energy-transmitting devices such as electrocautery/fulguration, laser, focused ultrasound or freezing.
 * Repair involves the direct closure or restoration of an injured, mutilated or deformed organ or body part, usually by suturing or internal fixation. Reconstruction is an extensive repair of a complex body part (such as joints), often with some degrees of structural/functional replacement and commonly involves grafting and/or use of implants.
 * Grafting is the relocation and establishment of a tissue from one part of the body to another. A flap is the relocation of a tissue without complete separation of its original attachment, and a free flap is a completely detached flap that carries an intact neurovascular structure ready for grafting onto a new location.
 * Bypass involves the relocation/grafting of a tubular structure onto another in order to reroute the content flow of that target structure from a specific segment directly to a more distal ("downstream") segment.
 * Implantation is insertion of artificial medical devices to replace or augment existing tissue.
 * Transplantation is the replacement of an organ or body part by insertion of another from a different human (or animal) into the person undergoing surgery. Harvesting is the resection of an organ or body part from a live human or animal (known as the donor) for transplantation into another patient (known as the recipient).
 * By organ system: Surgical specialties are traditionally and academically categorized by the organ, organ system or body region involved. Examples include:
 * Cardiac surgery — the heart and mediastinal great vessels;
 * Thoracic surgery — the thoracic cavity including the lungs;
 * Gastrointestinal surgery — the digestive tract and its accessory organs;
 * Vascular surgery — the extra-mediastinal great vessels and peripheral circulatory system;
 * Urological surgery — the genitourinary system;
 * ENT surgery — ear, nose and throat, also known as head and neck surgery when including the neck region;
 * Oral and maxillofacial surgery — the oral cavity, jaws, and face;
 * Neurosurgery — the central nervous system, and;
 * Orthopedic surgery — the musculoskeletal system.
 * By degree of invasiveness of surgical procedures:
 * Conventional open surgery (such as a laparotomy) requires a large incision to access the area of interest, and directly exposes the internal body cavity to the outside.
 * Minimally-invasive surgery involves much smaller surface incisions or even natural orifices (nostril, mouth, anus or urethra) to insert miniaturized instruments within a body cavity or structure, as in laparoscopic surgery or angioplasty.
 * Hybrid surgery uses a combination of open and minimally-invasive techniques, and may include hand ports or larger incisions to assist with performance of elements of the procedure.
 * By equipment used:
 * Laser surgery involves use of laser ablation to divide tissue instead of a scalpel, scissors or similar sharp-edged instruments.
 * Cryosurgery uses low-temperature cryoablation to freeze and destroy a target tissue.
 * Electrosurgery involves use of electrocautery to cut and coagulate tissue.
 * Microsurgery involves the use of an operating microscope for the surgeon to see and manipulate small structures.
 * Endoscopic surgery uses optical instruments to relay the image from inside an enclosed body cavity to the outside, and the surgeon performs the procedure using specialized handheld instruments inserted through trocars placed through the body wall. Most modern endoscopic procedures are video-assisted, meaning the images are viewed on a display screen rather than through the eyepiece on the endoscope.
 * Robotic surgery makes use of robotics such as the Da Vinci or the ZEUS robotic surgical systems, to remotely control endoscopic or minimally-invasive instruments.

Terminology

 * Resection and excisional procedures start with a prefix for the target organ to be excised (cut out) and end in the suffix -ectomy. For example, removal of part of the stomach would be called a subtotal gastrectomy.
 * Procedures involving cutting into an organ or tissue end in -otomy. A surgical procedure cutting through the abdominal wall to gain access to the abdominal cavity is a laparotomy.
 * Minimally invasive procedures, involving small incisions through which an endoscope is inserted, end in -oscopy. For example, such surgery in the abdominal cavity is called laparoscopy.
 * Procedures for formation of a permanent or semi-permanent opening called a stoma in the body end in -ostomy, such as creation of a colostomy, a connection of colon and the abdominal wall. This prefix is also used for connection between two viscera, such as how an esophagojejunostomy refers to a connection created between the esophagus and the jejunum.
 * Plastic and reconstruction procedures start with the name for the body part to be reconstructed and end in -plasty. For example, rhino- is a prefix meaning "nose", therefore a rhinoplasty is a reconstructive or cosmetic surgery for the nose. A pyloroplasty refers to a type of reconstruction of the gastric pylorus.
 * Procedures that involve cutting the muscular layers of an organ end in -myotomy. A pyloromyotomy refers to cutting the muscular layers of the gastric pylorus.
 * Repair of a damaged or abnormal structure ends in -orraphy. This includes herniorrhaphy, another name for a hernia repair.
 * Reoperation, revision, or "redo" procedures refer to a planned or unplanned return to the operating theater after a surgery is performed to re-address an aspect of patient care. Unplanned reasons for reoperation include postoperative complications such as bleeding or hematoma formation, development of a seroma or abscess, anastomotic leak, tissue necrosis requiring debridement or excision, or in the case of malignancy, close or involved resection margins that may require re-excision to avoid local recurrence. Reoperation can be performed in the acute phase, or it can be also performed months to years later if the surgery failed to solve the indicated problem. Reoperation can also be planned as a staged operation where components of the procedure are performed and/or reversed under separate anesthesia.

Setting
Inpatient surgery is performed in a hospital, and the person undergoing surgery stays at least one night in the hospital after the surgery. Outpatient surgery occurs in a hospital outpatient department or freestanding ambulatory surgery center, and the person who had surgery is discharged the same working day. Office-based surgery occurs in a physician's office, and the person is discharged the same day.

At a hospital, modern surgery is often performed in an operating theater using surgical instruments, an operating table, and other equipment. Among United States hospitalizations for non-maternal and non-neonatal conditions in 2012, more than one-fourth of stays and half of hospital costs involved stays that included operating room (OR) procedures. The environment and procedures used in surgery are governed by the principles of aseptic technique: the strict separation of "sterile" (free of microorganisms) things from "unsterile" or "contaminated" things. All surgical instruments must be sterilized, and an instrument must be replaced or re-sterilized if it becomes contaminated (i.e. handled in an unsterile manner, or allowed to touch an unsterile surface). Operating room staff must wear sterile attire (scrubs, a scrub cap, a sterile surgical gown, sterile latex or non-latex polymer gloves and a surgical mask), and they must scrub hands and arms with an approved disinfectant agent before each procedure.

Preoperative care
Prior to surgery, the person is given a medical examination, receives certain pre-operative tests, and their physical status is rated according to the ASA physical status classification system. If these results are satisfactory, the person requiring surgery signs a consent form and is given a surgical clearance. If the procedure is expected to result in significant blood loss, an autologous blood donation may be made some weeks prior to surgery. If the surgery involves the digestive system, the person requiring surgery may be instructed to perform a bowel prep by drinking a solution of polyethylene glycol the night before the procedure. People preparing for surgery are also instructed to abstain from food or drink (an NPO order after midnight on the night before the procedure), to minimize the effect of stomach contents on pre-operative medications and reduce the risk of aspiration if the person vomits during or after the procedure.

Some medical systems have a practice of routinely performing chest x-rays before surgery. The premise behind this practice is that the physician might discover some unknown medical condition which would complicate the surgery, and that upon discovering this with the chest x-ray, the physician would adapt the surgery practice accordingly., citing
 * Last reviewed 2011.
 * However, medical specialty professional organizations recommend against routine pre-operative chest x-rays for people who have an unremarkable medical history and presented with a physical exam which did not indicate a chest x-ray. Routine x-ray examination is more likely to result in problems like misdiagnosis, overtreatment, or other negative outcomes than it is to result in a benefit to the person. Likewise, other tests including complete blood count, prothrombin time, partial thromboplastin time, basic metabolic panel, and urinalysis should not be done unless the results of these tests can help evaluate surgical risk., which cites
 * However, medical specialty professional organizations recommend against routine pre-operative chest x-rays for people who have an unremarkable medical history and presented with a physical exam which did not indicate a chest x-ray. Routine x-ray examination is more likely to result in problems like misdiagnosis, overtreatment, or other negative outcomes than it is to result in a benefit to the person. Likewise, other tests including complete blood count, prothrombin time, partial thromboplastin time, basic metabolic panel, and urinalysis should not be done unless the results of these tests can help evaluate surgical risk., which cites
 * However, medical specialty professional organizations recommend against routine pre-operative chest x-rays for people who have an unremarkable medical history and presented with a physical exam which did not indicate a chest x-ray. Routine x-ray examination is more likely to result in problems like misdiagnosis, overtreatment, or other negative outcomes than it is to result in a benefit to the person. Likewise, other tests including complete blood count, prothrombin time, partial thromboplastin time, basic metabolic panel, and urinalysis should not be done unless the results of these tests can help evaluate surgical risk., which cites
 * However, medical specialty professional organizations recommend against routine pre-operative chest x-rays for people who have an unremarkable medical history and presented with a physical exam which did not indicate a chest x-ray. Routine x-ray examination is more likely to result in problems like misdiagnosis, overtreatment, or other negative outcomes than it is to result in a benefit to the person. Likewise, other tests including complete blood count, prothrombin time, partial thromboplastin time, basic metabolic panel, and urinalysis should not be done unless the results of these tests can help evaluate surgical risk., which cites
 * However, medical specialty professional organizations recommend against routine pre-operative chest x-rays for people who have an unremarkable medical history and presented with a physical exam which did not indicate a chest x-ray. Routine x-ray examination is more likely to result in problems like misdiagnosis, overtreatment, or other negative outcomes than it is to result in a benefit to the person. Likewise, other tests including complete blood count, prothrombin time, partial thromboplastin time, basic metabolic panel, and urinalysis should not be done unless the results of these tests can help evaluate surgical risk., which cites
 * However, medical specialty professional organizations recommend against routine pre-operative chest x-rays for people who have an unremarkable medical history and presented with a physical exam which did not indicate a chest x-ray. Routine x-ray examination is more likely to result in problems like misdiagnosis, overtreatment, or other negative outcomes than it is to result in a benefit to the person. Likewise, other tests including complete blood count, prothrombin time, partial thromboplastin time, basic metabolic panel, and urinalysis should not be done unless the results of these tests can help evaluate surgical risk., which cites

Preparing for surgery
A surgical team may include a surgeon, anesthetist, a circulating nurse, and a "scrub tech", or surgical technician, as well as other assistants who provide equipment and supplies as required. While informed consent discussions may be performed in a clinic or acute care setting, the pre-operative holding area is where documentation is reviewed and where family members can also meet the surgical team. Nurses in the preoperative holding area confirm orders and answer additional questions of the family members of the patient prior to surgery. In the pre-operative holding area, the person preparing for surgery changes out of their street clothes and are asked to confirm the details of his or her surgery as previously discussed during the process of informed consent. A set of vital signs are recorded, a peripheral IV line is placed, and pre-operative medications (antibiotics, sedatives, etc.) are given.

When the patient enters the operating room and is appropriately anesthetized, the team will then position the patient in an appropriate surgical position. If hair is present at the surgical site, it is clipped (instead of shaving). The skin surface within the operating field is cleansed and prepared by applying an antiseptic (typically chlorhexidine gluconate in alcohol, as this is twice as effective as povidone-iodine at reducing the risk of infection). Sterile drapes are then used to cover the borders of the operating field. Depending on the type of procedure, the cephalad drapes are secured to a pair of poles near the head of the bed to form an "ether screen", which separate the anesthetist/anesthesiologist's working area (unsterile) from the surgical site (sterile).

Anesthesia is administered to prevent pain from the trauma of cutting, tissue manipulation, application of thermal energy, and suturing. Depending on the type of operation, anesthesia may be provided locally, regionally, or as general anesthesia. Spinal anesthesia may be used when the surgical site is too large or deep for a local block, but general anesthesia may not be desirable. With local and spinal anesthesia, the surgical site is anesthetized, but the person can remain conscious or minimally sedated. In contrast, general anesthesia may render the person unconscious and paralyzed during surgery. The person is typically intubated to protect their airway and placed on a mechanical ventilator, and anesthesia is produced by a combination of injected and inhaled agents. The choice of surgical method and anesthetic technique aims to solve the indicated problem, minimize the risk of complications, optimize the time needed for recovery, and limit the surgical stress response.

Intraoperative phase
The intraoperative phase begins when the surgery subject is received in the surgical area (such as the operating theater or surgical department), and lasts until the subject is transferred to a recovery area (such as a post-anesthesia care unit).

An incision is made to access the surgical site. Blood vessels may be clamped or cauterized to prevent bleeding, and retractors may be used to expose the site or keep the incision open. The approach to the surgical site may involve several layers of incision and dissection, as in abdominal surgery, where the incision must traverse skin, subcutaneous tissue, three layers of muscle and then the peritoneum. In certain cases, bone may be cut to further access the interior of the body; for example, cutting the skull for brain surgery or cutting the sternum for thoracic (chest) surgery to open up the rib cage. Whilst in surgery aseptic technique is used to prevent infection or further spreading of the disease. The surgeons' and assistants' hands, wrists and forearms are washed thoroughly for at least 4 minutes to prevent germs getting into the operative field, then sterile gloves are placed onto their hands. An antiseptic solution is applied to the area of the person's body that will be operated on. Sterile drapes are placed around the operative site. Surgical masks are worn by the surgical team to avoid germs on droplets of liquid from their mouths and noses from contaminating the operative site.

Work to correct the problem in body then proceeds. This work may involve:

 * excision – cutting out an organ, tumor, or other tissue.
 * resection – partial removal of an organ or other bodily structure.
 * reconnection of organs, tissues, etc., particularly if severed. Resection of organs such as intestines involves reconnection.  Internal suturing or stapling may be used.  Surgical connection between blood vessels or other tubular or hollow structures such as loops of intestine is called anastomosis.
 * reduction – the movement or realignment of a body part to its normal position. e.g. Reduction of a broken nose involves the physical manipulation of the bone or cartilage from their displaced state back to their original position to restore normal airflow and aesthetics.
 * ligation – tying off blood vessels, ducts, or "tubes".
 * grafts – may be severed pieces of tissue cut from the same (or different) body or flaps of tissue still partly connected to the body but resewn for rearranging or restructuring of the area of the body in question. Although grafting is often used in cosmetic surgery, it is also used in other surgery.  Grafts may be taken from one area of the person's body and inserted to another area of the body.  An example is bypass surgery, where clogged blood vessels are bypassed with a graft from another part of the body.  Alternatively, grafts may be from other persons, cadavers, or animals.
 * insertion of prosthetic parts when needed. Pins or screws to set and hold bones may be used.  Sections of bone may be replaced with prosthetic rods or other parts.  Sometimes a plate is inserted to replace a damaged area of skull.  Artificial hip replacement has become more common.  Heart pacemakers or valves may be inserted.  Many other types of prostheses are used.
 * creation of a stoma, a permanent or semi-permanent opening in the body
 * in transplant surgery, the donor organ (taken out of the donor's body) is inserted into the recipient's body and reconnected to the recipient in all necessary ways (blood vessels, ducts, etc.).
 * arthrodesis – surgical connection of adjacent bones so the bones can grow together into one. Spinal fusion is an example of adjacent vertebrae connected allowing them to grow together into one piece.
 * modifying the digestive tract in bariatric surgery for weight loss.
 * repair of a fistula, hernia, or prolapse.
 * repair according to the ICD-10-PCS, in the Medical and Surgical Section 0, root operation Q, means restoring, to the extent possible, a body part to its normal anatomic structure and function. This definition, repair, is used only when the method used to accomplish the repair is not one of the other root operations. Examples would be colostomy takedown, herniorrhaphy of a hernia, and the surgical suture of a laceration.
 * other procedures, including:
 * clearing clogged ducts, blood or other vessels
 * removal of calculi (stones)
 * draining of accumulated fluids
 * debridement – removal of dead, damaged, or diseased tissue

Blood or blood expanders may be administered to compensate for blood lost during surgery. Once the procedure is complete, sutures or staples are used to close the incision. Once the incision is closed, the anesthetic agents are stopped or reversed, and the person is taken off ventilation and extubated (if general anesthesia was administered).

Postoperative care
After completion of surgery, the person is transferred to the post anesthesia care unit and closely monitored. When the person is judged to have recovered from the anesthesia, he/she is either transferred to a surgical ward elsewhere in the hospital or discharged home. During the post-operative period, the person's general function is assessed, the outcome of the procedure is assessed, and the surgical site is checked for signs of infection. There are several risk factors associated with postoperative complications, such as immune deficiency and obesity. Obesity has long been considered a risk factor for adverse post-surgical outcomes. It has been linked to many disorders such as obesity hypoventilation syndrome, atelectasis and pulmonary embolism, adverse cardiovascular effects, and wound healing complications. If removable skin closures are used, they are removed after 7 to 10 days post-operatively, or after healing of the incision is well under way.

It is not uncommon for surgical drains to be required to remove blood or fluid from the surgical wound during recovery. Mostly these drains stay in until the volume tapers off, then they are removed. These drains can become clogged, leading to abscess.

Postoperative therapy may include adjuvant treatment such as chemotherapy, radiation therapy, or administration of medication such as anti-rejection medication for transplants. For postoperative nausea and vomiting (PONV), solutions like saline, water, controlled breathing placebo and aromatherapy can be used in addition to medication. Other follow-up studies or rehabilitation may be prescribed during and after the recovery period. A recent post-operative care philosophy has been early ambulation. Ambulation is getting the patient moving around. This can be as simple as sitting up or even walking around. The goal is to get the patient moving as early as possible. It has been found to shorten the patient's length of stay. Length of stay is the amount of time a patient spends in the hospital after surgery before they are discharged. In a recent study done with lumbar decompressions, the patient's length of stay was decreased by 1–3 days.

The use of topical antibiotics on surgical wounds to reduce infection rates has been questioned. Antibiotic ointments are likely to irritate the skin, slow healing, and could increase risk of developing contact dermatitis and antibiotic resistance. It has also been suggested that topical antibiotics should only be used when a person shows signs of infection and not as a preventative. A systematic review published by Cochrane (organisation) in 2016, though, concluded that topical antibiotics applied over certain types of surgical wounds reduce the risk of surgical site infections, when compared to no treatment or use of antiseptics. The review also did not find conclusive evidence to suggest that topical antibiotics increased the risk of local skin reactions or antibiotic resistance.

Through a retrospective analysis of national administrative data, the association between mortality and day of elective surgical procedure suggests a higher risk in procedures carried out later in the working week and on weekends. The odds of death were 44% and 82% higher respectively when comparing procedures on a Friday to a weekend procedure. This "weekday effect" has been postulated to be from several factors including poorer availability of services on a weekend, and also, decrease number and level of experience over a weekend.

Postoperative pain affects an estimated 80% of people who underwent surgery. While pain is expected after surgery, there is growing evidence that pain may be inadequately treated in many people in the acute period immediately after surgery. It has been reported that incidence of inadequately controlled pain after surgery ranged from 25.1% to 78.4% across all surgical disciplines. There is insufficient evidence to determine if giving opioid pain medication pre-emptively (before surgery) reduces postoperative pain the amount of medication needed after surgery.

Postoperative recovery has been defined as an energy‐requiring process to decrease physical symptoms, reach a level of emotional well‐being, regain functions, and re‐establish activities. Moreover, it has been identified that patients who have undergone surgery are often not fully recovered on discharge.

United States
In 2011, of the 38.6 million hospital stays in U.S. hospitals, 29% included at least one operating room procedure. These stays accounted for 48% of the total $387 billion in hospital costs.

The overall number of procedures remained stable from 2001 to 2011. In 2011, over 15 million operating room procedures were performed in U.S. hospitals.

Data from 2003 to 2011 showed that U.S. hospital costs were highest for the surgical service line; the surgical service line costs were $17,600 in 2003 and projected to be $22,500 in 2013. For hospital stays in 2012 in the United States, private insurance had the highest percentage of surgical expenditure. in 2012, mean hospital costs in the United States were highest for surgical stays.

Elderly people
Older adults have widely varying physical health. Frail elderly people are at significant risk of post-surgical complications and the need for extended care. Assessment of older people before elective surgery can accurately predict the person's recovery trajectories. One frailty scale uses five items: unintentional weight loss, muscle weakness, exhaustion, low physical activity, and slowed walking speed. A healthy person scores 0; a very frail person scores 5. Compared to non-frail elderly people, people with intermediate frailty scores (2 or 3) are twice as likely to have post-surgical complications, spend 50% more time in the hospital, and are three times as likely to be discharged to a skilled nursing facility instead of to their own homes. People who are frail and elderly (score of 4 or 5) have even worse outcomes, with the risk of being discharged to a nursing home rising to twenty times the rate for non-frail elderly people.

Children
Surgery on children requires considerations that are not common in adult surgery. Children and adolescents are still developing physically and mentally making it difficult for them to make informed decisions and give consent for surgical treatments. Bariatric surgery in youth is among the controversial topics related to surgery in children.

Vulnerable populations
Doctors perform surgery with the consent of the person undergoing surgery. Some people are able to give better informed consent than others. Populations such as incarcerated persons, people living with dementia, the mentally incompetent, persons subject to coercion, and other people who are not able to make decisions with the same authority as others, have special needs when making decisions about their personal healthcare, including surgery.

Global surgery
Global surgery has been defined as 'the multidisciplinary enterprise of providing improved and equitable surgical care to the world's population, with its core belief as the issues of need, access and quality". Halfdan T. Mahler, the 3rd Director-General of the World Health Organization (WHO), first brought attention to the disparities in surgery and surgical care in 1980 when he stated in his address to the World Congress of the International College of Surgeons, "'the vast majority of the world's population has no access whatsoever to skilled surgical care and little is being done to find a solution.As such, surgical care globally has been described as the 'neglected stepchild of global health,' a term coined by Paul Farmer to highlight the urgent need for further work in this area. Furthermore, Jim Young Kim, the former President of the World Bank, proclaimed in 2014 that "surgery is an indivisible, indispensable part of health care and of progress towards universal health coverage."

In 2015, the Lancet Commission on Global Surgery (LCoGS) published the landmark report titled "Global Surgery 2030: evidence and solutions for achieving health, welfare, and economic development", describing the large, pre-existing burden of surgical diseases in low- and middle-income countries (LMICs) and future directions for increasing universal access to safe surgery by the year 2030. The Commission highlighted that about 5 billion people lack access to safe and affordable surgical and anesthesia care and 143 million additional procedures were needed every year to prevent further morbidity and mortality from treatable surgical conditions as well as a $12.3 trillion loss in economic productivity by the year 2030. This was especially true in the poorest countries, which account for over one-third of the population but only 3.5% of all surgeries that occur worldwide. It emphasized the need to significantly improve the capacity for Bellwether procedures – laparotomy, caesarean section, open fracture care – which are considered a minimum level of care that first-level hospitals should be able to provide in order to capture the most basic emergency surgical care. In terms of the financial impact on the patients, the lack of adequate surgical and anesthesia care has resulted in 33 million individuals every year facing catastrophic health expenditure – the out-of-pocket healthcare cost exceeding 40% of a given household's income.

In alignment with the LCoGS call for action, the World Health Assembly adopted the resolution WHA68.15 in 2015 that stated, "Strengthening emergency and essential surgical care and anesthesia as a component of universal health coverage." This not only mandated the WHO to prioritize strengthening the surgical and anesthesia care globally, but also led to governments of the member states recognizing the urgent need for increasing capacity in surgery and anesthesia. Additionally, the third edition of Disease Control Priorities (DCP3), published in 2015 by the World Bank, declared surgery as essential and featured an entire volume dedicated to building surgical capacity.

Data from WHO and the World Bank indicate that scaling up infrastructure to enable access to surgical care in regions where it is currently limited or is non-existent is a low-cost measure relative to the significant morbidity and mortality caused by lack of surgical treatment. In fact, a systematic review found that the cost-effectiveness ratio – dollars spent per DALYs averted – for surgical interventions is on par or exceeds those of major public health interventions such as oral rehydration therapy, breastfeeding promotion, and even HIV/AIDS antiretroviral therapy. This finding challenged the common misconception that surgical care is financially prohibitive endeavor not worth pursuing in LMICs.

A key policy framework that arose from this renewed global commitment towards surgical care worldwide is the National Surgical Obstetric and Anesthesia Plan (NSOAP). NSOAP focuses on policy-to-action capacity building for surgical care with tangible steps as follows: (1) analysis of baseline indicators, (2) partnership with local champions, (3) broad stakeholder engagement, (4) consensus building and synthesis of ideas, (5) language refinement, (6) costing, (7) dissemination, and (8) implementation. This approach has been widely adopted and has served as guiding principles between international collaborators and local institutions and governments. Successful implementations have allowed for sustainability in terms of longterm monitoring, quality improvement, and continued political and financial support.

Human rights
Access to surgical care is increasingly recognized as an integral aspect of healthcare, and therefore is evolving into a normative derivation of human right to health. The ICESCR Article 12.1 and 12.2 define the human right to health as "the right of everyone to the enjoyment of the highest attainable standard of physical and mental health" In the August 2000, the UN Committee on Economic, Social and Cultural Rights (CESCR) interpreted this to mean "right to the enjoyment of a variety of facilities, goods, services, and conditions necessary for the realization of the highest attainable health". Surgical care can be thereby viewed as a positive right – an entitlement to protective healthcare.

Woven through the International Human and Health Rights literature is the right to be free from surgical disease. The 1966 ICESCR Article 12.2a described the need for "provision for the reduction of the stillbirth-rate and of infant mortality and for the healthy development of the child" which was subsequently interpreted to mean "requiring measures to improve… emergency obstetric services". Article 12.2d of the ICESCR stipulates the need for "the creation of conditions which would assure to all medical service and medical attention in the event of sickness", and is interpreted in the 2000 comment to include timely access to "basic preventative, curative services… for appropriate treatment of injury and disability.". Obstetric care shares close ties with reproductive rights, which includes access to reproductive health.

Surgeons and public health advocates, such as Kelly McQueen, have described surgery as "Integral to the right to health". This is reflected in the establishment of the WHO Global Initiative for Emergency and Essential Surgical Care in 2005, the 2013 formation of the Lancet Commission for Global Surgery, the 2015 World Bank Publication of Volume 1 of its Disease Control Priorities Project "Essential Surgery", and the 2015 World Health Assembly 68.15 passing of the Resolution for Strengthening Emergency and Essential Surgical Care and Anesthesia as a Component of Universal Health Coverage. The Lancet Commission for Global Surgery outlined the need for access to "available, affordable, timely and safe" surgical and anesthesia care; dimensions paralleled in ICESCR General Comment No. 14, which similarly outlines need for available, accessible, affordable and timely healthcare.

Trepanation
Surgical treatments date back to the prehistoric era. The oldest for which there is evidence is trepanation, in which a hole is drilled or scraped into the skull, thus exposing the dura mater in order to treat health problems related to intracranial pressure

Ancient Egypt
Prehistoric surgical techniques are seen in Ancient Egypt, where a mandible dated to approximately 2650 BC shows two perforations just below the root of the first molar, indicating the draining of an abscessed tooth. Surgical texts from ancient Egypt date back about 3500 years ago. Surgical operations were performed by priests, specialized in medical treatments similar to today, and used sutures to close wounds. Infections were treated with honey.

India
9,000-year-old skeletal remains of a prehistoric individual from the Indus River valley show evidence of teeth having been drilled. Sushruta Samhita is one of the oldest known surgical texts and its period is usually placed in the first millennium BCE. It describes in detail the examination, diagnosis, treatment, and prognosis of numerous ailments, as well as procedures for various forms of cosmetic surgery, plastic surgery and rhinoplasty.

Sri Lanka
In 1982 archaeologists were able to find significant evidence when the ancient land, called 'Alahana Pirivena' situated in Polonnaruwa, with ruins, was excavated. In that place ruins of an ancient hospital emerged. The hospital building was 147.5 feet in width and 109.2 feet in length. The instruments which were used for complex surgeries were there among the things discovered from the place, including forceps, scissors, probes, lancets, and scalpels. The instruments discovered may be dated to 11th century AD.

Ancient and Medieval Greece

In ancient Greece, temples dedicated to the healer-god Asclepius, known as Asclepieia (Ασκληπιεία, sing. Asclepieion Ασκληπιείον), functioned as centers of medical advice, prognosis, and healing. In the Asclepieion of Epidaurus, some of the surgical cures listed, such as the opening of an abdominal abscess or the removal of traumatic foreign material, are realistic enough to have taken place. The Greek Galen was one of the greatest surgeons of the ancient world and performed many audacious operations – including brain and eye surgery – that were not tried again for almost two millennia. Hippocrates stated in the oath (c. 400 BCE) that general physicians must never practice surgery and that surgical procedures are to be conducted by specialists

Researchers from the Adelphi University discovered in the Paliokastro on Thasos ten skeletal remains, four women and six men, who were buried between the fourth and seventh centuries A.D. Their bones illuminated their physical activities, traumas, and even a complex form of brain surgery. According to the researchers: "The very serious trauma cases sustained by both males and females had been treated surgically or orthopedically by a very experienced physician/surgeon with great training in trauma care. We believe it to have been a military physician". The researchers were impressed by the complexity of the brain surgical operation.

In 1991 at the Polystylon fort in Greece, researchers discovered the head of a Byzantine warrior of the 14th century. Analysis of the lower jaw revealed that a surgery has been performed, when the warrior was alive, to the jaw which had been badly fractured and it tied back together until it healed.

Islamic world
During the Islamic Golden Age, largely based upon Paul of Aegina's Pragmateia, the writings of Albucasis (Abu al-Qasim Khalaf ibn al-Abbas Al-Zahrawi), an Andalusian-Arab physician and scientist who practiced in the Zahra suburb of Córdoba, were influential. Al-Zahrawi specialized in curing disease by cauterization. He invented several surgical instruments for purposes such as inspection of the interior of the urethra and for removing foreign bodies from the throat, the ear, and other body organs. He was also the first to illustrate the various cannulae and to treat warts with an iron tube and caustic metal as a boring instrument. He describes what is thought to be the first attempt at reduction mammaplasty for the management of gynaecomastia and the first mastectomy to treat breast cancer. He is credited with the performance of the first thyroidectomy. Al-Zahrawi pioneered techniques of neurosurgery and neurological diagnosis, treating head injuries, skull fractures, spinal injuries, hydrocephalus, subdural effusions and headache. The first clinical description of an operative procedure for hydrocephalus was given by Al-Zahrawi, who clearly describes the evacuation of superficial intracranial fluid in hydrocephalic children.

Early modern Europe
In Europe, the demand grew for surgeons to formally study for many years before practicing; universities such as Montpellier, Padua and Bologna were particularly renowned. In the 12th century, Rogerius Salernitanus composed his Chirurgia, laying the foundation for modern Western surgical manuals. Barber-surgeons generally had a bad reputation that was not to improve until the development of academic surgery as a specialty of medicine, rather than an accessory field. Basic surgical principles for asepsis etc., are known as Halsteads principles.

There were some important advances to the art of surgery during this period. The professor of anatomy at the University of Padua, Andreas Vesalius, was a pivotal figure in the Renaissance transition from classical medicine and anatomy based on the works of Galen, to an empirical approach of 'hands-on' dissection. In his anatomic treaties De humani corporis fabrica, he exposed the many anatomical errors in Galen and advocated that all surgeons should train by engaging in practical dissections themselves.

The second figure of importance in this era was Ambroise Paré (sometimes spelled "Ambrose" ), a French army surgeon from the 1530s until his death in 1590. The practice for cauterizing gunshot wounds on the battlefield had been to use boiling oil; an extremely dangerous and painful procedure. Paré began to employ a less irritating emollient, made of egg yolk, rose oil and turpentine. He also described more efficient techniques for the effective ligation of the blood vessels during an amputation.

Modern surgery
The discipline of surgery was put on a sound, scientific footing during the Age of Enlightenment in Europe. An important figure in this regard was the Scottish surgical scientist, John Hunter, generally regarded as the father of modern scientific surgery. He brought an empirical and experimental approach to the science and was renowned around Europe for the quality of his research and his written works. Hunter reconstructed surgical knowledge from scratch; refusing to rely on the testimonies of others, he conducted his own surgical experiments to determine the truth of the matter. To aid comparative analysis, he built up a collection of over 13,000 specimens of separate organ systems, from the simplest plants and animals to humans.

He greatly advanced knowledge of venereal disease and introduced many new techniques of surgery, including new methods for repairing damage to the Achilles tendon and a more effective method for applying ligature of the arteries in case of an aneurysm. He was also one of the first to understand the importance of pathology, the danger of the spread of infection and how the problem of inflammation of the wound, bone lesions and even tuberculosis often undid any benefit that was gained from the intervention. He consequently adopted the position that all surgical procedures should be used only as a last resort.

Other important 18th- and early 19th-century surgeons included Percival Pott (1713–1788) who described tuberculosis on the spine and first demonstrated that a cancer may be caused by an environmental carcinogen (he noticed a connection between chimney sweep's exposure to soot and their high incidence of scrotal cancer). Astley Paston Cooper (1768–1841) first performed a successful ligation of the abdominal aorta, and James Syme (1799–1870) pioneered the Symes Amputation for the ankle joint and successfully carried out the first hip disarticulation.

Modern pain control through anesthesia was discovered in the mid-19th century. Before the advent of anesthesia, surgery was a traumatically painful procedure and surgeons were encouraged to be as swift as possible to minimize patient suffering. This also meant that operations were largely restricted to amputations and external growth removals. Beginning in the 1840s, surgery began to change dramatically in character with the discovery of effective and practical anaesthetic chemicals such as ether, first used by the American surgeon Crawford Long, and chloroform, discovered by Scottish obstetrician James Young Simpson and later pioneered by John Snow, physician to Queen Victoria. In addition to relieving patient suffering, anaesthesia allowed more intricate operations in the internal regions of the human body. In addition, the discovery of muscle relaxants such as curare allowed for safer applications.

Infection and antisepsis
The introduction of anesthetics encouraged more surgery, which inadvertently caused more dangerous patient post-operative infections. The concept of infection was unknown until relatively modern times. The first progress in combating infection was made in 1847 by the Hungarian doctor Ignaz Semmelweis who noticed that medical students fresh from the dissecting room were causing excess maternal death compared to midwives. Semmelweis, despite ridicule and opposition, introduced compulsory handwashing for everyone entering the maternal wards and was rewarded with a plunge in maternal and fetal deaths; however, the Royal Society dismissed his advice. Until the pioneering work of British surgeon Joseph Lister in the 1860s, most medical men believed that chemical damage from exposures to bad air (see "miasma") was responsible for infections in wounds, and facilities for washing hands or a patient's wounds were not available. Lister became aware of the work of French chemist Louis Pasteur, who showed that rotting and fermentation could occur under anaerobic conditions if micro-organisms were present. Pasteur suggested three methods to eliminate the micro-organisms responsible for gangrene: filtration, exposure to heat, or exposure to chemical solutions. Lister confirmed Pasteur's conclusions with his own experiments and decided to use his findings to develop antiseptic techniques for wounds. As the first two methods suggested by Pasteur were inappropriate for the treatment of human tissue, Lister experimented with the third, spraying carbolic acid on his instruments. He found that this remarkably reduced the incidence of gangrene and he published his results in The Lancet. Later, on 9 August 1867, he read a paper before the British Medical Association in Dublin, on the Antiseptic Principle of the Practice of Surgery, which was reprinted in the British Medical Journal. His work was groundbreaking and laid the foundations for a rapid advance in infection control that saw modern antiseptic operating theatres widely used within 50 years.

Lister continued to develop improved methods of antisepsis and asepsis when he realised that infection could be better avoided by preventing bacteria from getting into wounds in the first place. This led to the rise of sterile surgery. Lister introduced the Steam Steriliser to sterilize equipment, instituted rigorous hand washing and later implemented the wearing of rubber gloves. These three crucial advances – the adoption of a scientific methodology toward surgical operations, the use of anaesthetic and the introduction of sterilised equipment – laid the groundwork for the modern invasive surgical techniques of today.

The use of X-rays as an important medical diagnostic tool began with their discovery in 1895 by German physicist Wilhelm Röntgen. He noticed that these rays could penetrate the skin, allowing the skeletal structure to be captured on a specially treated photographic plate.

Surgical specialties

 * General surgery

 * Breast
 * Cardiothoracic
 * Colorectal
 * Craniofacial surgery
 * Dental surgery
 * Endocrine
 * Gynaecology
 * Neurosurgery
 * Ophthalmology
 * Oncological
 * Oral and maxillofacial surgery
 * Transplant
 * Orthopaedic surgery
 * Hand surgery
 * Otolaryngology
 * Paediatric (Pediatric)
 * Periodontal surgery
 * Plastic
 * Podiatric surgery
 * Skin
 * Trauma
 * Urology
 * Vascular

Learned societies

 * World Federation of Neurosurgical Societies
 * American College of Surgeons
 * American College of Osteopathic Surgeons
 * American Academy of Orthopedic Surgeons
 * American College of Foot and Ankle Surgeons
 * Royal Australasian College of Surgeons
 * Royal Australasian College of Dental Surgeons
 * Royal College of Physicians and Surgeons of Canada
 * Royal College of Surgeons in Ireland
 * Royal College of Surgeons of Edinburgh
 * Royal College of Physicians and Surgeons of Glasgow
 * Royal College of Surgeons of England

List of Surgery-related fields

 * Bariatric surgery
 * Cardiac surgery
 * Cardiothoracic surgery
 * Colorectal surgery
 * Endocrine surgery
 * Ophthalmology
 * General surgery
 * Neurosurgery
 * Oral and maxillofacial surgery
 * Orthopedic surgery
 * Hand surgery
 * Otolaryngology
 * Pediatric surgery
 * Plastic surgery
 * Reproductive surgery
 * Surgical oncology
 * Transplant surgery
 * Trauma surgery
 * Urology
 * Andrology
 * Vascular surgery

title: Surgery


text:
Reed–Solomon error correction

Reed–Solomon codes are a group of error-correcting codes that were introduced by Irving S. Reed and Gustave Solomon in 1960. They have many applications, including consumer technologies such as MiniDiscs, CDs, DVDs, Blu-ray discs, QR codes, Data Matrix, data transmission technologies such as DSL and WiMAX, broadcast systems such as satellite communications, DVB and ATSC, and storage systems such as RAID 6.

Reed–Solomon codes operate on a block of data treated as a set of finite-field elements called symbols. Reed–Solomon codes are able to detect and correct multiple symbol errors. By adding $t$ = $n$ − $k$ check symbols to the data, a Reed–Solomon code can detect (but not correct) any combination of up to $t$ erroneous symbols, or locate and correct up to $⌊t/2⌋$ erroneous symbols at unknown locations. As an erasure code, it can correct up to $t$ erasures at locations that are known and provided to the algorithm, or it can detect and correct combinations of errors and erasures. Reed–Solomon codes are also suitable as multiple-burst bit-error correcting codes, since a sequence of $b + 1$ consecutive bit errors can affect at most two symbols of size $b$. The choice of $t$ is up to the designer of the code and may be selected within wide limits.

There are two basic types of Reed–Solomon codes – original view and BCH view –  with BCH view being the most common, as BCH view decoders are faster and require less working storage than original view decoders.

History
Reed–Solomon codes were developed in 1960 by Irving S. Reed and Gustave Solomon, who were then staff members of MIT Lincoln Laboratory. Their seminal article was titled "Polynomial Codes over Certain Finite Fields". . The original encoding scheme described in the Reed & Solomon article used a variable polynomial based on the message to be encoded where only a fixed set of values (evaluation points) to be encoded are known to encoder and decoder. The original theoretical decoder generated potential polynomials based on subsets of k (unencoded message length) out of n (encoded message length) values of a received message, choosing the most popular polynomial as the correct one, which was impractical for all but the simplest of cases. This was initially resolved by changing the original scheme to a BCH code like scheme based on a fixed polynomial known to both encoder and decoder, but later, practical decoders based on the original scheme were developed, although slower than the BCH schemes. The result of this is that there are two main types of Reed Solomon codes, ones that use the original encoding scheme, and ones that use the BCH encoding scheme.

Also in 1960, a practical fixed polynomial decoder for BCH codes developed by Daniel Gorenstein and Neal Zierler was described in an MIT Lincoln Laboratory report by Zierler in January 1960 and later in a paper in June 1961. The Gorenstein–Zierler decoder and the related work on BCH codes are described in a book Error Correcting Codes by W. Wesley Peterson (1961). By 1963 (or possibly earlier), J. J. Stone (and others) recognized that Reed Solomon codes could use the BCH scheme of using a fixed generator polynomial, making such codes a special class of BCH codes, but Reed Solomon codes based on the original encoding scheme, are not a class of BCH codes, and depending on the set of evaluation points, they are not even cyclic codes.

In 1969, an improved BCH scheme decoder was developed by Elwyn Berlekamp and James Massey, and has since been known as the Berlekamp–Massey decoding algorithm.

In 1975, another improved BCH scheme decoder was developed by Yasuo Sugiyama, based on the extended Euclidean algorithm.

In 1977, Reed–Solomon codes were implemented in the Voyager program in the form of concatenated error correction codes. The first commercial application in mass-produced consumer products appeared in 1982 with the compact disc, where two interleaved Reed–Solomon codes are used. Today, Reed–Solomon codes are widely implemented in digital storage devices and digital communication standards, though they are being slowly replaced by Bose–Chaudhuri–Hocquenghem (BCH) codes. For example, Reed–Solomon codes are used in the Digital Video Broadcasting (DVB) standard DVB-S, in conjunction with a convolutional inner code, but BCH codes are used with LDPC in its successor, DVB-S2.

In 1986, an original scheme decoder known as the Berlekamp–Welch algorithm was developed.

In 1996, variations of original scheme decoders called list decoders or soft decoders were developed by Madhu Sudan and others, and work continues on these types of decoders – see Guruswami–Sudan list decoding algorithm.

In 2002, another original scheme decoder was developed by Shuhong Gao, based on the extended Euclidean algorithm.

Data storage
Reed–Solomon coding is very widely used in mass storage systems to correct the burst errors associated with media defects.

Reed–Solomon coding is a key component of the compact disc. It was the first use of strong error correction coding in a mass-produced consumer product, and DAT and DVD use similar schemes. In the CD, two layers of Reed–Solomon coding separated by a 28-way convolutional interleaver yields a scheme called Cross-Interleaved Reed–Solomon Coding (CIRC). The first element of a CIRC decoder is a relatively weak inner (32,28) Reed–Solomon code, shortened from a (255,251) code with 8-bit symbols. This code can correct up to 2 byte errors per 32-byte block. More importantly, it flags as erasures any uncorrectable blocks, i.e., blocks with more than 2 byte errors. The decoded 28-byte blocks, with erasure indications, are then spread by the deinterleaver to different blocks of the (28,24) outer code. Thanks to the deinterleaving, an erased 28-byte block from the inner code becomes a single erased byte in each of 28 outer code blocks. The outer code easily corrects this, since it can handle up to 4 such erasures per block.

The result is a CIRC that can completely correct error bursts up to 4000 bits, or about 2.5 mm on the disc surface. This code is so strong that most CD playback errors are almost certainly caused by tracking errors that cause the laser to jump track, not by uncorrectable error bursts.

DVDs use a similar scheme, but with much larger blocks, a (208,192) inner code, and a (182,172) outer code.

Reed–Solomon error correction is also used in parchive files which are commonly posted accompanying multimedia files on USENET. The distributed online storage service Wuala (discontinued in 2015) also used Reed–Solomon when breaking up files.

Bar code
Almost all two-dimensional bar codes such as PDF-417, MaxiCode, Datamatrix, QR Code, and Aztec Code use Reed–Solomon error correction to allow correct reading even if a portion of the bar code is damaged. When the bar code scanner cannot recognize a bar code symbol, it will treat it as an erasure.

Reed–Solomon coding is less common in one-dimensional bar codes, but is used by the PostBar symbology.

Data transmission
Specialized forms of Reed–Solomon codes, specifically Cauchy-RS and Vandermonde-RS, can be used to overcome the unreliable nature of data transmission over erasure channels. The encoding process assumes a code of RS(N, K) which results in N codewords of length N symbols each storing K symbols of data, being generated, that are then sent over an erasure channel.

Any combination of K codewords received at the other end is enough to reconstruct all of the N codewords. The code rate is generally set to 1/2 unless the channel's erasure likelihood can be adequately modelled and is seen to be less. In conclusion, N is usually 2K, meaning that at least half of all the codewords sent must be received in order to reconstruct all of the codewords sent.

Reed–Solomon codes are also used in xDSL systems and CCSDS's Space Communications Protocol Specifications as a form of forward error correction.

Space transmission

One significant application of Reed–Solomon coding was to encode the digital pictures sent back by the Voyager program.

Voyager introduced Reed–Solomon coding concatenated with convolutional codes, a practice that has since become very widespread in deep space and satellite (e.g., direct digital broadcasting) communications.

Viterbi decoders tend to produce errors in short bursts. Correcting these burst errors is a job best done by short or simplified Reed–Solomon codes.

Modern versions of concatenated Reed–Solomon/Viterbi-decoded convolutional coding were and are used on the Mars Pathfinder, Galileo, Mars Exploration Rover and Cassini missions, where they perform within about 1–1.5 dB of the ultimate limit, the Shannon capacity.

These concatenated codes are now being replaced by more powerful turbo codes:

Constructions (encoding)
The Reed–Solomon code is actually a family of codes, where every code is characterised by three parameters: an alphabet size $$q$$, a block length $$n$$, and a message length $$k$$, with $$k < n \leq q$$. The set of alphabet symbols is interpreted as the finite field $$F$$ of order $$q$$, and thus, $$q$$ must be a prime power. In the most useful parameterizations of the Reed–Solomon code, the block length is usually some constant multiple of the message length, that is, the rate $$R = \frac{k}{n}$$ is some constant, and furthermore, the block length is equal to or one less than the alphabet size, that is, $$n=q$$ or $$n=q-1$$.

Reed & Solomon's original view: The codeword as a sequence of values
There are different encoding procedures for the Reed–Solomon code, and thus, there are different ways to describe the set of all codewords. In the original view of, every codeword of the Reed–Solomon code is a sequence of function values of a polynomial of degree less than $$k$$. In order to obtain a codeword of the Reed–Solomon code, the message symbols (each within the q-sized alphabet) are treated as the coefficients of a polynomial $$p$$ of degree less than k, over the finite field $$F$$ with $$q$$ elements. In turn, the polynomial p is evaluated at n ≤ q distinct points $$a_1, \dots, a_n$$ of the field F, and the sequence of values is the corresponding codeword. Common choices for a set of evaluation points include {0, 1, 2, ..., n − 1}, {0, 1, α, α2, ..., αn−2}, or for n < q, {1, α, α2, ..., αn−1}, ..., where α is a primitive element of F.

Formally, the set $$\mathbf{C}$$ of codewords of the Reed–Solomon code is defined as follows: $$ \mathbf{C} = \Bigl\{\; \bigl( p(a_1), p(a_2), \dots, p(a_n) \bigr) \;\Big|\; p \text{ is a polynomial over } F \text{ of degree } <k \;\Bigr\}\,. $$ Since any two distinct polynomials of degree less than $$k$$ agree in at most $$k-1$$ points, this means that any two codewords of the Reed–Solomon code disagree in at least $$n - (k-1) = n-k+1$$ positions. Furthermore, there are two polynomials that do agree in $$k-1$$ points but are not equal, and thus, the distance of the Reed–Solomon code is exactly $$d=n-k+1$$. Then the relative distance is $$\delta = d/n = 1-k/n + 1/n = 1-R+1/n\sim 1-R$$, where $$R=k/n$$ is the rate. This trade-off between the relative distance and the rate is asymptotically optimal since, by the Singleton bound, every code satisfies $$\delta+R\leq 1+1/n$$. Being a code that achieves this optimal trade-off, the Reed–Solomon code belongs to the class of maximum distance separable codes.

While the number of different polynomials of degree less than k and the number of different messages are both equal to $$q^k$$, and thus every message can be uniquely mapped to such a polynomial, there are different ways of doing this encoding. The original construction of interprets the message x as the coefficients of the polynomial p, whereas subsequent constructions interpret the message as the values of the polynomial at the first k points $$a_1,\dots,a_k$$ and obtain the polynomial p by interpolating these values with a polynomial of degree less than k. The latter encoding procedure, while being slightly less efficient, has the advantage that it gives rise to a systematic code, that is, the original message is always contained as a subsequence of the codeword.

Simple encoding procedure: The message as a sequence of coefficients
In the original construction of, the message $$m=(m_0,\dots,m_{k-1}) \in F^k $$ is mapped to the polynomial $$p_m$$ with $$p_m(a) = \sum_{i=0}^{k-1} m_i a^{i} \,.$$ The codeword of $$m$$ is obtained by evaluating $$p_m$$ at $$n$$ different points $$a_0, \dots, a_{n-1}$$ of the field $$F$$. Thus the classical encoding function $$C:F^k \to F^n$$ for the Reed–Solomon code is defined as follows: $$C(m) = \begin{bmatrix} p_m(a_0) \\ p_m(a_1) \\ \cdots \\ p_m(a_{n-1}) \end{bmatrix}$$ This function $$C$$ is a linear mapping, that is, it satisfies $$C(m) = Am $$ for the following $$n \times k$$-matrix $$A$$ with elements from $$F$$: $$C(m) = Am = \begin{bmatrix} 1 & a_0 & a_0^2 & \dots & a_0^{k-1} \\ 1 & a_1 & a_1^2 & \dots & a_1^{k-1} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & a_{n-1} & a_{n-1}^2 & \dots & a_{n-1}^{k-1} \end{bmatrix} \begin{bmatrix} m_0 \\ m_1 \\ \vdots \\ m_{k-1} \end{bmatrix} $$

This matrix is a Vandermonde matrix over $$F$$. In other words, the Reed–Solomon code is a linear code, and in the classical encoding procedure, its generator matrix is $$A$$.

Systematic encoding procedure: The message as an initial sequence of values
There is an alternative encoding procedure that produces a systematic Reed–Solomon code. Here, we use a different polynomial $$p_m

$$. In this variant, the polynomial $$p_m$$ is defined as the unique polynomial of degree less than $$k$$ such that $$p_m(a_i) = m_i \text{ for all } i\in\{0,\dots,k - 1\}. $$ To compute this polynomial $$p_m$$ from $$m$$, one can use Lagrange interpolation. Once it has been found, it is evaluated at the other points $$a_k, \dots, a_{n - 1} $$.

$$C(m) = \begin{bmatrix} p_m(a_0) \\ p_m(a_1) \\ \cdots \\ p_m(a_{n-1}) \end{bmatrix}$$

This variant is systematic since the first $$k$$ entries, $$p_m(a_0), \dots, p_m(a_{k-1})$$, are exactly $$m_0, \dots, m_{k-1}$$ by the definition of $$p_m$$.

Discrete Fourier transform and its inverse
A discrete Fourier transform is essentially the same as the encoding procedure; it uses the generator polynomial $$p_m$$ to map a set of evaluation points into the message values as shown above: $$C(m) = \begin{bmatrix} p_m(a_0) \\ p_m(a_1) \\ \cdots \\ p_m(a_{n-1}) \end{bmatrix}$$

The inverse Fourier transform could be used to convert an error free set of n < q message values back into the encoding polynomial of k coefficients, with the constraint that in order for this to work, the set of evaluation points used to encode the message must be a set of increasing powers of α: $$a_i = \alpha^i$$ $$a_0, \dots, a_{n-1} = \{ 1, \alpha, \alpha^2, \dots, \alpha^{n-1} \}$$

However, Lagrange interpolation performs the same conversion without the constraint on the set of evaluation points or the requirement of an error free set of message values and is used for systematic encoding, and in one of the steps of the Gao decoder.

The BCH view: The codeword as a sequence of coefficients
In this view, the message is interpreted as the coefficients of a polynomial $$p(x)$$. The sender computes a related polynomial $$s(x)$$ of degree $$n-1$$ where $$n \le q-1$$ and sends the polynomial $$s(x)$$. The polynomial $$s(x)$$ is constructed by multiplying the message polynomial $$p(x)$$, which has degree $$k-1$$, with a generator polynomial $$g(x)$$ of degree $$n-k$$ that is known to both the sender and the receiver. The generator polynomial $$g(x)$$ is defined as the polynomial whose roots are sequential powers of the Galois field primitive $$\alpha$$ $$g(x) = \left(x-\alpha^{i}\right) \left(x-\alpha^{i+1}\right) \cdots \left(x-\alpha^{i+n-k-1}\right) = g_0 + g_1x + \cdots + g_{n-k-1}x^{n-k-1} + x^{n-k}$$

For a "narrow sense code", $$i = 1$$.

$$\mathbf{C} = \left\{ \left ( s_1, s_2,\dots, s_{n} \right) \;\Big|\; s(a)=\sum_{i=1}^n s_i a^{i} \text{ is a polynomial that has at least the roots } \alpha^1,\alpha^2, \dots, \alpha^{n-k} \right\} .$$

Systematic encoding procedure
The encoding procedure for the BCH view of Reed–Solomon codes can be modified to yield a systematic encoding procedure, in which each codeword contains the message as a prefix, and simply appends error correcting symbols as a suffix. Here, instead of sending $$s(x) = p(x) g(x)$$, the encoder constructs the transmitted polynomial $$s(x)$$ such that the coefficients of the $$k$$ largest monomials are equal to the corresponding coefficients of $$p(x)$$, and the lower-order coefficients of $$s(x)$$ are chosen exactly in such a way that $$s(x)$$ becomes divisible by $$g(x)$$. Then the coefficients of $$p(x)$$ are a subsequence of the coefficients of $$s(x)$$. To get a code that is overall systematic, we construct the message polynomial $$p(x)$$ by interpreting the message as the sequence of its coefficients.

Formally, the construction is done by multiplying $$p(x)$$ by $$x^t$$ to make room for the $$t=n-k$$ check symbols, dividing that product by $$g(x)$$ to find the remainder, and then compensating for that remainder by subtracting it. The $$t$$ check symbols are created by computing the remainder $$s_r(x)$$: $$s_r(x) = p(x)\cdot x^t \ \bmod \ g(x).$$

The remainder has degree at most $$t-1$$, whereas the coefficients of $$x^{t-1},x^{t-2},\dots,x^1,x^0$$ in the polynomial $$p(x)\cdot x^t$$ are zero. Therefore, the following definition of the codeword $$s(x)$$ has the property that the first $$k$$ coefficients are identical to the coefficients of $$p(x)$$: $$s(x) = p(x)\cdot x^t - s_r(x)\,.$$

As a result, the codewords $$s(x)$$ are indeed elements of $$\mathbf{C}$$, that is, they are divisible by the generator polynomial $$g(x)$$: $$s(x) \equiv p(x) \cdot x^t - s_r(x) \equiv s_r(x) - s_r(x) \equiv 0 \mod g(x)\,.$$

Properties
The Reed–Solomon code is a [n, k, n − k + 1] code; in other words, it is a linear block code of length n (over F) with dimension k and minimum Hamming distance $d_{\min} = n-k+1.$ The Reed–Solomon code is optimal in the sense that the minimum distance has the maximum value possible for a linear code of size (n, k); this is known as the Singleton bound. Such a code is also called a maximum distance separable (MDS) code.

The error-correcting ability of a Reed–Solomon code is determined by its minimum distance, or equivalently, by $$n - k$$, the measure of redundancy in the block. If the locations of the error symbols are not known in advance, then a Reed–Solomon code can correct up to $$(n-k)/2$$ erroneous symbols, i.e., it can correct half as many errors as there are redundant symbols added to the block. Sometimes error locations are known in advance (e.g., "side information" in demodulator signal-to-noise ratios)—these are called erasures. A Reed–Solomon code (like any MDS code) is able to correct twice as many erasures as errors, and any combination of errors and erasures can be corrected as long as the relation $2E + S ≤ n − k$ is satisfied, where $$E$$ is the number of errors and $$S$$ is the number of erasures in the block.

The theoretical error bound can be described via the following formula for the AWGN channel for FSK: $$P_b \approx \frac{2^{m-1}}{2^m-1}\frac{1}{n}\sum_{\ell=t+1}^n \ell {n\choose \ell}P_s^\ell(1-P_s)^{n-\ell}$$ and for other modulation schemes: $$P_b \approx \frac{1}{m}\frac{1}{n}\sum_{\ell=t+1}^n \ell {n\choose \ell} P_s^\ell(1-P_s)^{n-\ell}$$ where $t = \frac{1}{2}(d_{\min}-1)$, $$P_s = 1-(1-s)^h$$, $$h = \frac{m}{\log_2M}$$, $$s$$ is the symbol error rate in uncoded AWGN case and $$M$$ is the modulation order.

For practical uses of Reed–Solomon codes, it is common to use a finite field $$F$$ with $$2^m$$ elements. In this case, each symbol can be represented as an $$m$$-bit value. The sender sends the data points as encoded blocks, and the number of symbols in the encoded block is $$n = 2^m - 1$$. Thus a Reed–Solomon code operating on 8-bit symbols has $$n = 2^8 - 1 = 255$$ symbols per block. (This is a very popular value because of the prevalence of byte-oriented computer systems.) The number $$k$$, with $$k < n$$, of data symbols in the block is a design parameter. A commonly used code encodes $$k = 223$$ eight-bit data symbols plus 32 eight-bit parity symbols in an $$n = 255$$-symbol block; this is denoted as a $$(n, k) = (255,223)$$ code, and is capable of correcting up to 16 symbol errors per block.

The Reed–Solomon code properties discussed above make them especially well-suited to applications where errors occur in bursts. This is because it does not matter to the code how many bits in a symbol are in error — if multiple bits in a symbol are corrupted it only counts as a single error. Conversely, if a data stream is not characterized by error bursts or drop-outs but by random single bit errors, a Reed–Solomon code is usually a poor choice compared to a binary code.

The Reed–Solomon code, like the convolutional code, is a transparent code. This means that if the channel symbols have been inverted somewhere along the line, the decoders will still operate. The result will be the inversion of the original data. However, the Reed–Solomon code loses its transparency when the code is shortened. The "missing" bits in a shortened code need to be filled by either zeros or ones, depending on whether the data is complemented or not. (To put it another way, if the symbols are inverted, then the zero-fill needs to be inverted to a one-fill.) For this reason it is mandatory that the sense of the data (i.e., true or complemented) be resolved before Reed–Solomon decoding.

Whether the Reed–Solomon code is cyclic or not depends on subtle details of the construction. In the original view of Reed and Solomon, where the codewords are the values of a polynomial, one can choose the sequence of evaluation points in such a way as to make the code cyclic. In particular, if $$\alpha$$ is a primitive root of the field $$F$$, then by definition all non-zero elements of $$F$$ take the form $$\alpha^i$$ for $$i\in\{1,\dots,q-1\}$$, where $$q=|F|$$. Each polynomial $$p$$ over $$F$$ gives rise to a codeword $$(p(\alpha^1),\dots,p(\alpha^{q-1}))$$. Since the function $$a \mapsto p(\alpha a)$$ is also a polynomial of the same degree, this function gives rise to a codeword $$(p(\alpha^2),\dots,p(\alpha^{q}))$$; since $$\alpha^{q}=\alpha^1$$ holds, this codeword is the cyclic left-shift of the original codeword derived from $$p$$. So choosing a sequence of primitive root powers as the evaluation points makes the original view Reed–Solomon code cyclic. Reed–Solomon codes in the BCH view are always cyclic because BCH codes are cyclic.

Remarks
Designers are not required to use the "natural" sizes of Reed–Solomon code blocks. A technique known as "shortening" can produce a smaller code of any desired size from a larger code. For example, the widely used (255,223) code can be converted to a (160,128) code by padding the unused portion of the source block with 95 binary zeroes and not transmitting them. At the decoder, the same portion of the block is loaded locally with binary zeroes. The Delsarte–Goethals–Seidel theorem illustrates an example of an application of shortened Reed–Solomon codes. In parallel to shortening, a technique known as puncturing allows omitting some of the encoded parity symbols.

BCH view decoders
The decoders described in this section use the BCH view of a codeword as a sequence of coefficients. They use a fixed generator polynomial known to both encoder and decoder.

Peterson–Gorenstein–Zierler decoder
Daniel Gorenstein and Neal Zierler developed a decoder that was described in a MIT Lincoln Laboratory report by Zierler in January 1960 and later in a paper in June 1961. The Gorenstein–Zierler decoder and the related work on BCH codes are described in a book Error Correcting Codes by W. Wesley Peterson (1961).

Formulation
The transmitted message, $$(c_0, \ldots, c_i, \ldots,c_{n-1})$$, is viewed as the coefficients of a polynomial s(x): $$s(x) = \sum_{i = 0}^{n-1} c_i x^i$$

As a result of the Reed-Solomon encoding procedure, s(x) is divisible by the generator polynomial g(x): $$g(x) = \prod_{j=1}^{n-k} (x - \alpha^j), $$ where α is a primitive element.

Since s(x) is a multiple of the generator g(x), it follows that it "inherits" all its roots. $$s(x) \bmod (x-\alpha^j) = g(x) \bmod (x-\alpha^j) = 0$$ Therefore, $$s(\alpha^j) = 0, \ j=1,2,\ldots,n-k$$

The transmitted polynomial is corrupted in transit by an error polynomial e(x) to produce the received polynomial r(x). $$r(x) = s(x) + e(x)$$ $$e(x) = \sum_{i=0}^{n-1} e_i x^i $$

Coefficient ei will be zero if there is no error at that power of x and nonzero if there is an error. If there are ν errors at distinct powers ik of x, then $$e(x) = \sum_{k=1}^\nu e_{i_k} x^{i_k}$$

The goal of the decoder is to find the number of errors (ν), the positions of the errors (ik), and the error values at those positions (ei k ). From those, e(x) can be calculated and subtracted from r(x) to get the originally sent message s(x).

Syndrome decoding
The decoder starts by evaluating the polynomial as received at points $$\alpha^1 \dots \alpha^{n-k}$$. We call the results of that evaluation the "syndromes", Sj. They are defined as: $$ \begin{align} S_j &= r(\alpha^j) = s(\alpha^j) + e(\alpha^j) = 0 + e(\alpha^j) \\ &= e(\alpha^j) \\ &= \sum_{k=1}^\nu e_{i_k} \left( \alpha^j \right)^{i_k}, \quad j=1,2,\ldots,n-k \end{align} $$ Note that $$s(\alpha^j) = 0$$ because $$s(x)$$ has roots at $$\alpha^j$$, as shown in the previous section.

The advantage of looking at the syndromes is that the message polynomial drops out. In other words, the syndromes only relate to the error, and are unaffected by the actual contents of the message being transmitted. If the syndromes are all zero, the algorithm stops here and reports that the message was not corrupted in transit.

Error locators and error values
For convenience, define the error locators Xk and error values Yk as: $$ X_k = \alpha^{i_k}, \ Y_k = e_{i_k} $$

Then the syndromes can be written in terms of these error locators and error values as $$ S_j = \sum_{k=1}^{\nu} Y_k X_k^j $$

This definition of the syndrome values is equivalent to the previous since $$(\alpha^j)^{i_k} = \alpha ^ {j*i_k} = (\alpha^{i_k})^j = X_k^j$$.

The syndromes give a system of $n − k ≥ 2ν$ equations in 2ν unknowns, but that system of equations is nonlinear in the Xk and does not have an obvious solution. However, if the Xk were known (see below), then the syndrome equations provide a linear system of equations that can easily be solved for the Yk error values.

$$\begin{bmatrix} X_1^1 & X_2^1 & \cdots & X_\nu^1 \\ X_1^2 & X_2^2 & \cdots & X_\nu^2 \\ \vdots & \vdots & \ddots & \vdots \\ X_1^{n-k} & X_2^{n-k} & \cdots & X_\nu^{n-k} \\ \end{bmatrix} \begin{bmatrix} Y_1 \\ Y_2 \\ \vdots \\ Y_\nu \end{bmatrix} = \begin{bmatrix} S_1 \\ S_2 \\ \vdots \\ S_{n-k} \end{bmatrix} $$

Consequently, the problem is finding the Xk, because then the leftmost matrix would be known, and both sides of the equation could be multiplied by its inverse, yielding Yk

In the variant of this algorithm where the locations of the errors are already known (when it is being used as an erasure code), this is the end. The error locations (Xk) are already known by some other method (for example, in an FM transmission, the sections where the bitstream was unclear or overcome with interference are probabilistically determinable from frequency analysis). In this scenario, up to $$n-k$$ errors can be corrected.

The rest of the algorithm serves to locate the errors, and will require syndrome values up to $$2v$$, instead of just the $$v$$ used thus far. This is why twice as many error correcting symbols need to be added as can be corrected without knowing their locations.

Error locator polynomial
There is a linear recurrence relation that gives rise to a system of linear equations. Solving those equations identifies those error locations Xk.

Define the error locator polynomial $Λ(x)$ as $$\Lambda(x) = \prod_{k=1}^\nu (1 - x X_k ) = 1 + \Lambda_1 x^1 + \Lambda_2 x^2 + \cdots + \Lambda_\nu x^\nu$$

The zeros of $Λ(x)$ are the reciprocals $$X_k^{-1}$$. This follows from the above product notation construction since if $$x=X_k^{-1}$$ then one of the multiplied terms will be zero $$(1 - X_k^{-1} \cdot X_k) = 1 - 1 = 0$$, making the whole polynomial evaluate to zero. $$ \Lambda(X_k^{-1}) = 0 $$

Let $$j$$ be any integer such that $$1 \leq j \leq \nu$$. Multiply both sides by $$Y_k X_k^{j+\nu}$$ and it will still be zero. $$\begin{align} & Y_k X_k^{j+\nu} \Lambda(X_k^{-1}) = 0. \\[1ex] & Y_k X_k^{j+\nu} \left(1 + \Lambda_1 X_k^{-1} + \Lambda_2 X_k^{-2} + \cdots + \Lambda_\nu X_k^{-\nu}\right) = 0. \\[1ex] & Y_k X_k^{j+\nu} + \Lambda_1 Y_k X_k^{j+\nu} X_k^{-1} + \Lambda_2 Y_k X_k^{j+\nu} X_k^{-2} + \cdots + \Lambda_\nu Y_k X_k^{j+\nu} X_k^{-\nu} = 0. \\[1ex] & Y_k X_k^{j+\nu} + \Lambda_1 Y_k X_k^{j+\nu-1} + \Lambda_2 Y_k X_k^{j+\nu -2} + \cdots + \Lambda_{\nu} Y_k X_k^j = 0. \end{align} $$

Sum for k = 1 to ν and it will still be zero. $$ \sum_{k=1}^\nu \left( Y_k X_k^{j+\nu} + \Lambda_1 Y_k X_k^{j+\nu-1} + \Lambda_2 Y_k X_k^{j+\nu -2} + \cdots + \Lambda_{\nu} Y_k X_k^{j} \right) = 0 $$

Collect each term into its own sum. $$ \left(\sum_{k=1}^\nu Y_k X_k^{j+\nu} \right) + \left(\sum_{k=1}^\nu \Lambda_1 Y_k X_k^{j+\nu-1}\right) + \left(\sum_{k=1}^\nu \Lambda_2 Y_k X_k^{j+\nu -2}\right) + \cdots + \left(\sum_{k=1}^\nu \Lambda_\nu Y_k X_k^j \right) = 0 $$

Extract the constant values of $$\Lambda$$ that are unaffected by the summation. $$ \left(\sum_{k=1}^\nu Y_k X_k^{j+\nu} \right) + \Lambda_1 \left(\sum_{k=1}^\nu Y_k X_k^{j+\nu-1}\right) + \Lambda_2 \left(\sum_{k=1}^\nu Y_k X_k^{j+\nu -2}\right) + \cdots + \Lambda_\nu \left(\sum_{k=1}^\nu Y_k X_k^j \right) = 0 $$

These summations are now equivalent to the syndrome values, which we know and can substitute in! This therefore reduces to $$ S_{j + \nu} + \Lambda_1 S_{j+\nu-1} + \cdots + \Lambda_{\nu-1} S_{j+1} + \Lambda_{\nu} S_j  = 0 $$

Subtracting $$S_{j+\nu}$$ from both sides yields $$ S_j \Lambda_{\nu} + S_{j+1}\Lambda_{\nu-1} + \cdots + S_{j+\nu-1} \Lambda_1 = - S_{j + \nu} $$

Recall that j was chosen to be any integer between 1 and v inclusive, and this equivalence is true for any and all such values. Therefore, we have v linear equations, not just one. This system of linear equations can therefore be solved for the coefficients Λi of the error location polynomial: $$\begin{bmatrix} S_1 & S_2 & \cdots & S_{\nu} \\ S_2 & S_3 & \cdots & S_{\nu+1} \\ \vdots & \vdots & \ddots & \vdots \\ S_{\nu} & S_{\nu+1} & \cdots & S_{2\nu-1} \end{bmatrix} \begin{bmatrix} \Lambda_{\nu} \\ \Lambda_{\nu-1} \\ \vdots \\ \Lambda_1 \end{bmatrix} = \begin{bmatrix} - S_{\nu+1} \\ - S_{\nu+2} \\ \vdots \\ - S_{\nu+\nu} \end{bmatrix} $$ The above assumes the decoder knows the number of errors ν, but that number has not been determined yet. The PGZ decoder does not determine ν directly but rather searches for it by trying successive values. The decoder first assumes the largest value for a trial ν and sets up the linear system for that value. If the equations can be solved (i.e., the matrix determinant is nonzero), then that trial value is the number of errors. If the linear system cannot be solved, then the trial ν is reduced by one and the next smaller system is examined.

Find the roots of the error locator polynomial
Use the coefficients Λi found in the last step to build the error location polynomial. The roots of the error location polynomial can be found by exhaustive search. The error locators Xk are the reciprocals of those roots. The order of coefficients of the error location polynomial can be reversed, in which case the roots of that reversed polynomial are the error locators $$X_k$$ (not their reciprocals $$X_k^{-1}$$). Chien search is an efficient implementation of this step.

Calculate the error values
Once the error locators Xk are known, the error values can be determined. This can be done by direct solution for Yk in the error equations matrix given above, or using the Forney algorithm.

Calculate the error locations
Calculate ik by taking the log base $$\alpha$$ of Xk. This is generally done using a precomputed lookup table.

Fix the errors
Finally, e(x) is generated from ik and ei k  and then is subtracted from r(x) to get the originally sent message s(x), with errors corrected.

Example
Consider the Reed–Solomon code defined in $GF(929)$ with $α = 3$ and $t = 4$ (this is used in PDF417 barcodes) for a RS(7,3) code. The generator polynomial is $$g(x) = (x-3) (x-3^2) (x-3^3) (x-3^4) = x^4 + 809 x^3 + 723 x^2 + 568 x + 522$$ If the message polynomial is $p(x) = 3 x^{2} + 2 x + 1$, then a systematic codeword is encoded as follows. $$s_r(x) = p(x) \, x^t \bmod g(x) = 547 x^3 + 738 x^2 + 442 x + 455$$ $$s(x) = p(x) \, x^t - s_r(x) = 3 x^6 + 2 x^5 + 1 x^4 + 382 x^3 + 191 x^2 + 487 x + 474$$ Errors in transmission might cause this to be received instead. $$r(x) = s(x) + e(x) = 3 x^6 + 2 x^5 + 123 x^4 + 456 x^3 + 191 x^2 + 487 x + 474$$ The syndromes are calculated by evaluating r at powers of α. $$S_1 = r(3^1) = 3\cdot 3^6 + 2\cdot 3^5 + 123\cdot 3^4 + 456\cdot 3^3 + 191\cdot 3^2 + 487\cdot 3 + 474 = 732$$ $$S_2 = r(3^2) = 637,\;S_3 = r(3^3) = 762,\;S_4 = r(3^4) = 925$$ $$\begin{bmatrix} 732 & 637 \\ 637 & 762 \end{bmatrix} \begin{bmatrix} \Lambda_2 \\ \Lambda_1 \end{bmatrix} = \begin{bmatrix} -762 \\ -925 \end{bmatrix} = \begin{bmatrix} 167 \\ 004 \end{bmatrix} $$

Using Gaussian elimination: $$\begin{bmatrix} 001 & 000 \\ 000 & 001 \end{bmatrix} \begin{bmatrix} \Lambda_2 \\ \Lambda_1 \end{bmatrix} = \begin{bmatrix} 329 \\ 821 \end{bmatrix} $$

The coefficients can be reversed to produce roots with positive exponents, but typically this isn't used:

with the log of the roots corresponding to the error locations (right to left, location 0 is the last term in the codeword).

To calculate the error values, apply the Forney algorithm.

Subtracting $$e_1 x^3 + e_2 x^4 = 74x^3 + 122x^4$$ from the received polynomial r(x) reproduces the original codeword s.

Berlekamp–Massey decoder
The Berlekamp–Massey algorithm is an alternate iterative procedure for finding the error locator polynomial. During each iteration, it calculates a discrepancy based on a current instance of Λ(x) with an assumed number of errors e: $$ \Delta = S_{i} + \Lambda_1 \  S_{i-1} + \cdots + \Lambda_e \  S_{i-e}$$ and then adjusts Λ(x) and e so that a recalculated Δ would be zero. The article Berlekamp–Massey algorithm has a detailed description of the procedure. In the following example, C(x) is used to represent Λ(x).

Example
Using the same data as the Peterson Gorenstein Zierler example above: The final value of C is the error locator polynomial, Λ(x).

Euclidean decoder
Another iterative method for calculating both the error locator polynomial and the error value polynomial is based on Sugiyama's adaptation of the extended Euclidean algorithm.

Define S(x), Λ(x), and Ω(x) for t syndromes and e errors: $$ \begin{align} S(x) &= S_{t} x^{t-1} + S_{t-1} x^{t-2} + \cdots + S_2 x + S_1 \\[1ex] \Lambda(x) &= \Lambda_{e} x^{e} + \Lambda_{e-1} x^{e-1} + \cdots + \Lambda_{1} x + 1 \\[1ex] \Omega(x) &= \Omega_{e} x^{e} + \Omega_{e-1} x^{e-1} + \cdots + \Omega_{1} x + \Omega_{0} \end{align} $$

The key equation is: $$ \Lambda(x) S(x) = Q(x) x^{t} + \Omega(x) $$

For t = 6 and e = 3: $$\begin{bmatrix} \Lambda_3 S_6 & x^8 \\ \Lambda_2 S_6 + \Lambda_3 S_5 & x^7 \\ \Lambda_1 S_6 + \Lambda_2 S_5 + \Lambda_3 S_4 & x^6 \\ S_6 + \Lambda_1 S_5 + \Lambda_2 S_4 + \Lambda_3 S_3 & x^5 \\ S_5 + \Lambda_1 S_4 + \Lambda_2 S_3 + \Lambda_3 S_2 & x^4 \\ S_4 + \Lambda_1 S_3 + \Lambda_2 S_2 + \Lambda_3 S_1 & x^3 \\ S_3 + \Lambda_1 S_2 + \Lambda_2 S_1 & x^2 \\ S_2 + \Lambda_1 S_1 & x \\ S_1 \end{bmatrix} = \begin{bmatrix} Q_2 x^8 \\ Q_1 x^7 \\ Q_0 x^6 \\ 0 \\ 0 \\ 0 \\ \Omega_2 x^2 \\ \Omega_1 x \\ \Omega_0 \end{bmatrix} $$

The middle terms are zero due to the relationship between Λ and syndromes.

The extended Euclidean algorithm can find a series of polynomials of the form

where the degree of R decreases as i increases. Once the degree of Ri(x) < t/2, then

B(x) and Q(x) don't need to be saved, so the algorithm becomes:

R−1 := xt R0 := S(x) A−1 := 0 A0 := 1 i := 0 while degree of Ri ≥ t/2 i := i + 1 Q := Ri-2 / Ri-1 Ri := Ri-2 - Q Ri-1 Ai := Ai-2 - Q Ai-1 to set low order term of Λ(x) to 1, divide Λ(x) and Ω(x) by Ai(0):

Ai(0) is the constant (low order) term of Ai.

Example
Using the same data as the Peterson–Gorenstein–Zierler example above:

Decoder using discrete Fourier transform
A discrete Fourier transform can be used for decoding. To avoid conflict with syndrome names, let c(x) = s(x) the encoded codeword. r(x) and e(x) are the same as above. Define C(x), E(x), and R(x) as the discrete Fourier transforms of c(x), e(x), and r(x). Since r(x) = c(x) + e(x), and since a discrete Fourier transform is a linear operator, R(x) = C(x) + E(x).

Transform r(x) to R(x) using discrete Fourier transform. Since the calculation for a discrete Fourier transform is the same as the calculation for syndromes, t coefficients of R(x) and E(x) are the same as the syndromes: $$R_j = E_j = S_j = r(\alpha^j) \qquad \text{for } 1 \le j \le t$$

Use $$R_1$$ through $$R_t$$ as syndromes (they're the same) and generate the error locator polynomial using the methods from any of the above decoders.

Let v = number of errors. Generate E(x) using the known coefficients $$E_1$$ to $$E_t$$, the error locator polynomial, and these formulas $$\begin{align} E_0 &= - \frac{1}{\Lambda_v}(E_{v} + \Lambda_1 E_{v-1} + \cdots + \Lambda_{v-1} E_{1}) \\ E_j &= -(\Lambda_1 E_{j-1} + \Lambda_2 E_{j-2} + \cdots + \Lambda_v E_{j-v}) & \text{for } t < j < n \end{align}$$

Then calculate C(x) = R(x) − E(x) and take the inverse transform (polynomial interpolation) of C(x) to produce c(x).

Decoding beyond the error-correction bound
The Singleton bound states that the minimum distance d of a linear block code of size (n,k) is upper-bounded by $n − k + 1$. The distance d was usually understood to limit the error-correction capability to $⌊(d−1) / 2⌋$. The Reed–Solomon code achieves this bound with equality, and can thus correct up to $⌊(n−k) / 2⌋$ errors. However, this error-correction bound is not exact.

In 1999, Madhu Sudan and Venkatesan Guruswami at MIT published "Improved Decoding of Reed–Solomon and Algebraic-Geometry Codes" introducing an algorithm that allowed for the correction of errors beyond half the minimum distance of the code. It applies to Reed–Solomon codes and more generally to algebraic geometric codes. This algorithm produces a list of codewords (it is a list-decoding algorithm) and is based on interpolation and factorization of polynomials over $$GF(2^m)$$ and its extensions.

In 2023, building on three exciting works,  coding theorists showed that Reed-Solomon codes defined over random evaluation points can actually achieve list decoding capacity (up to $n−k$ errors) over linear size alphabets with high probability. However, this result is combinatorial rather than algorithmic.

Soft-decoding
The algebraic decoding methods described above are hard-decision methods, which means that for every symbol a hard decision is made about its value. For example, a decoder could associate with each symbol an additional value corresponding to the channel demodulator's confidence in the correctness of the symbol. The advent of LDPC and turbo codes, which employ iterated soft-decision belief propagation decoding methods to achieve error-correction performance close to the theoretical limit, has spurred interest in applying soft-decision decoding to conventional algebraic codes. In 2003, Ralf Koetter and Alexander Vardy presented a polynomial-time soft-decision algebraic list-decoding algorithm for Reed–Solomon codes, which was based upon the work by Sudan and Guruswami. In 2016, Steven J. Franke and Joseph H. Taylor published a novel soft-decision decoder.

Encoder
Here we present a simple MATLAB implementation for an encoder.

Decoder
Now the decoding part:

Reed Solomon original view decoders
The decoders described in this section use the Reed Solomon original view of a codeword as a sequence of polynomial values where the polynomial is based on the message to be encoded. The same set of fixed values are used by the encoder and decoder, and the decoder recovers the encoding polynomial (and optionally an error locating polynomial) from the received message.

Theoretical decoder
described a theoretical decoder that corrected errors by finding the most popular message polynomial. The decoder only knows the set of values $$a_1$$ to $$a_n$$ and which encoding method was used to generate the codeword's sequence of values. The original message, the polynomial, and any errors are unknown. A decoding procedure could use a method like Lagrange interpolation on various subsets of n codeword values taken k at a time to repeatedly produce potential polynomials, until a sufficient number of matching polynomials are produced to reasonably eliminate any errors in the received codeword. Once a polynomial is determined, then any errors in the codeword can be corrected, by recalculating the corresponding codeword values. Unfortunately, in all but the simplest of cases, there are too many subsets, so the algorithm is impractical. The number of subsets is the binomial coefficient, $ \binom{n}{k} = {n! \over (n-k)! k!}$, and the number of subsets is infeasible for even modest codes. For a $$(255,249)$$ code that can correct 3 errors, the naïve theoretical decoder would examine 359 billion subsets.

Berlekamp Welch decoder
In 1986, a decoder known as the Berlekamp–Welch algorithm was developed as a decoder that is able to recover the original message polynomial as well as an error "locator" polynomial that produces zeroes for the input values that correspond to errors, with time complexity $$O(n^3)$$, where $$n$$ is the number of values in a message. The recovered polynomial is then used to recover (recalculate as needed) the original message.

Example
Using RS(7,3), GF(929), and the set of evaluation points ai = i − 1

If the message polynomial is

The codeword is

Errors in transmission might cause this to be received instead.

The key equations are:

$$b_i E(a_i) - Q(a_i) = 0 $$

Assume maximum number of errors: e = 2. The key equations become:

$$b_i(e_0 + e_1 a_i) - (q_0 + q_1 a_i + q_2 a_i^2 + q_3 a_i^3 + q_4 a_i^4) = - b_i a_i^2$$

$$\begin{bmatrix} 001 & 000 & 928 & 000 & 000 & 000 & 000 \\ 006 & 006 & 928 & 928 & 928 & 928 & 928 \\ 123 & 246 & 928 & 927 & 925 & 921 & 913 \\ 456 & 439 & 928 & 926 & 920 & 902 & 848 \\ 057 & 228 & 928 & 925 & 913 & 865 & 673 \\ 086 & 430 & 928 & 924 & 904 & 804 & 304 \\ 121 & 726 & 928 & 923 & 893 & 713 & 562 \end{bmatrix} \begin{bmatrix} e_0 \\ e_1 \\ q_0 \\ q_1 \\ q_2 \\ q_3 \\ q_4 \end{bmatrix} = \begin{bmatrix} 000 \\ 923 \\ 437 \\ 541 \\ 017 \\ 637 \\ 289 \end{bmatrix} $$

Using Gaussian elimination:

$$ \begin{bmatrix} 001 & 000 & 000 & 000 & 000 & 000 & 000 \\ 000 & 001 & 000 & 000 & 000 & 000 & 000 \\ 000 & 000 & 001 & 000 & 000 & 000 & 000 \\ 000 & 000 & 000 & 001 & 000 & 000 & 000 \\ 000 & 000 & 000 & 000 & 001 & 000 & 000 \\ 000 & 000 & 000 & 000 & 000 & 001 & 000 \\ 000 & 000 & 000 & 000 & 000 & 000 & 001 \end{bmatrix} \begin{bmatrix} e_0 \\ e_1 \\ q_0 \\ q_1 \\ q_2 \\ q_3 \\ q_4 \end{bmatrix} = \begin{bmatrix} 006 \\ 924 \\ 006 \\ 007 \\ 009 \\ 916 \\ 003 \end{bmatrix} $$

Recalculate $a = {0, 1, 2, 3, 4, 5, 6}$ where $p(x) = 003 x^{2} + 002 x + 001$ to correct $c = {001, 006, 017, 034, 057, 086, 121}$ resulting in the corrected codeword:

Gao decoder
In 2002, an improved decoder was developed by Shuhong Gao, based on the extended Euclid algorithm.

Example
Using the same data as the Berlekamp Welch example above:

 * $$R_{-1} = \prod_{i=1}^n (x - a_i)$$
 * $$R_0 = $$ Lagrange interpolation of $$\{a_i, b(a_i)\}$$ for i = 1 to n
 * $$A_{-1} = 0$$
 * $$A_0 = 1$$

divide Q(x) and E(x) by most significant coefficient of E(x) = 708. (Optional)

Recalculate $b = c + e = {001, 006, 123, 456, 057, 086, 121}$ where $Q(x) = 003 x^{4} + 916 x^{3} + 009 x^{2} + 007 x + 006$ to correct $E(x) = 001 x^{2} + 924 x + 006$ resulting in the corrected codeword:

Information and tutorials

 * Introduction to Reed–Solomon codes: principles, architecture and implementation (CMU)
 * A Tutorial on Reed–Solomon Coding for Fault-Tolerance in RAID-like Systems
 * Algebraic soft-decoding of Reed–Solomon codes
 * Reed–Solomon codes for coders
 * BBC R&D White Paper WHP031
 * Concatenated codes by Dr. Dave Forney (scholarpedia.org).
 * Concatenated codes by Dr. Dave Forney (scholarpedia.org).

Implementations

 * FEC library in C by Phil Karn (aka KA9Q) includes Reed–Solomon codec, both arbitrary and optimized (223,255) version
 * Schifra Open Source C++ Reed–Solomon Codec
 * Henry Minsky's RSCode library, Reed–Solomon encoder/decoder
 * Open Source C++ Reed–Solomon Soft Decoding library
 * Matlab implementation of errors and-erasures Reed–Solomon decoding
 * Octave implementation in communications package
 * Pure-Python implementation of a Reed–Solomon codec

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: Reed–Solomon error correction