{
  "id": "aliasing",
  "title": "Aliasing",
  "lang": "en",
  "source_lang": "en",
  "summary": "Aliasing is the indistinguishability of different signals after sampling, producing false frequencies or patterns; in programming, it also means multiple references to the same storage.",
  "category": "computer-science",
  "subcategory": "algorithms-theory",
  "type": "concept",
  "aliases": [],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/aliasing/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/aliasing/",
      "json": "https://aiwiki.page/zh/aliasing.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Aliasing is a phenomenon in which different continuous signals produce the same sampled representation and therefore cannot be distinguished from the samples alone. In digital signal processing, it commonly occurs when sampling does not adequately resolve the signal’s variation: high-frequency content can appear as lower-frequency content, fine image patterns can become false coarse patterns, and moving objects can appear stationary or move backward. It is fundamental to digital audio, imaging, computer graphics, and scientific measurement. In programming, aliasing has a separate meaning: two or more references or expressions designate the same object or memory location."
    },
    {
      "heading": "Sampling and indistinguishability",
      "text": "Sampling represents a signal by its values at selected points. For a continuous-time signal \\(x(t)\\), uniform sampling at a rate \\(f_s\\) produces the sequence\n\n\\[x[n]=x\\left(\\frac{n}{f_s}\\right),\\]\n\nwhere \\(n\\) is an integer and \\(f_s\\) is measured in samples per second.\n\nConsider a complex sinusoid of frequency \\(f\\). Its samples are\n\n\\[x[n]=e^{i2\\pi fn/f_s}.\\]\n\nFor any integer \\(k\\),\n\n\\[e^{i2\\pi(f+kf_s)n/f_s} = e^{i2\\pi fn/f_s}.\\]\n\nThus, frequencies separated by an integer multiple of the sampling rate produce identical sampled complex sinusoids. Sampling identifies frequencies only up to these equivalences unless additional restrictions are imposed on the original signal.\n\nFor real-valued sinusoids, positive and negative frequencies introduce a further symmetry. A frequency can be folded into the interval from zero to \\(f_s/2\\). For a single real sinusoid, its apparent frequency can be expressed as\n\n\\[f_{\\mathrm{alias}}=\\min_{k\\in\\mathbb{Z}}|f-kf_s|,\\]\n\nwhich lies between zero and \\(f_s/2\\). Phase relationships must also be considered when comparing the complete sampled waveforms.\n\nFor example, a 7 kHz cosine sampled at 10 kHz produces the same samples as a 3 kHz cosine with the corresponding phase. Without prior information, the samples alone cannot establish which continuous signal was present."
    },
    {
      "heading": "The sampling theorem and frequency folding",
      "text": "The Nyquist–Shannon sampling theorem specifies conditions under which sampling does not lose information. In its familiar low-pass form, a signal with no frequency components above a bandwidth \\(B\\) can be reconstructed exactly from ideal uniform samples when\n\n\\[f_s>2B.\\]\n\nThe quantity \\(2B\\) is the Nyquist rate for that signal, whereas \\(f_s/2\\) is the Nyquist frequency for a particular sampling rate. These terms describe different quantities.\n\nThe theorem is an ideal mathematical result. It assumes an appropriate band-limited signal, exact samples, and an ideal reconstruction procedure. Sampling exactly at twice the highest frequency requires special care: for example, a sinusoid at the Nyquist frequency can have every sample equal to zero for a particular phase.\n\nThe Fourier transform provides a frequency-domain explanation. Uniform sampling creates periodically repeated copies of the original spectrum, spaced by \\(f_s\\). When these copies overlap, components from different frequency ranges contribute to the same sampled frequencies. This overlap is spectral aliasing.\n\nThe familiar low-pass condition is sufficient but not universal. A signal confined to a known frequency band away from zero can sometimes be sampled below twice its highest frequency without overlap. This is band-pass sampling, which depends on the occupied bandwidth and the placement of the spectral replicas, not simply on the highest frequency.\n\nThe mathematical foundations of sampling developed through work by several researchers, including Harry Nyquist, Vladimir Kotelnikov, and Claude Shannon. The theorem became central to the design of digital communication and signal-processing systems."
    },
    {
      "heading": "Temporal and spatial aliasing",
      "text": "Audio and other time-dependent signals\n\nIn audio acquisition, frequencies above the usable input band can fold into the recorded band. Unlike ordinary background noise, the resulting components are related systematically to the original signal and the sampling rate.\n\nAliasing can also arise inside a digital system, even if the original recording was properly sampled. Nonlinear operations such as clipping, distortion, and some forms of audio synthesis generate additional harmonics. Harmonics above the Nyquist frequency fold into the represented band unless the processing controls them.\n\nThe problem is distinct from quantization, which replaces signal amplitudes with a finite set of values. Sampling concerns where or when a signal is measured; quantization concerns the precision with which each measured value is represented. Increasing amplitude precision does not, by itself, prevent aliasing.\n\nImages and photography\n\nIn an image, sampling occurs over space rather than time. Fine stripes, fabrics, roof tiles, and other repeating structures may vary too rapidly for a camera sensor or output image grid to resolve.\n\nThe resulting artifacts include false bands, jagged edges, and moiré patterns. With color-filter-array sensors, spatial detail can also be misinterpreted as color variation. The interaction among optical resolution, sensor layout, and color reconstruction determines the appearance of these artifacts.\n\nFor a rectangular sampling grid, the ideal alias-free region is described by frequency limits along the grid’s axes. Consequently, resolution depends on pattern orientation as well as spacing.\n\nIn image processing, reducing an image’s dimensions is another sampling operation. Simply discarding rows and columns can turn fine detail into false coarse structure. Appropriate filtering before reduction suppresses detail that the smaller image cannot represent.\n\nMotion and frame sequences\n\nTemporal aliasing in video produces the wagon-wheel effect, in which rotating spokes appear to turn slowly, stand still, or rotate backward. The positions recorded in successive frames are compatible with several possible motions.\n\nExposure time also matters. A frame is usually an integration over a finite interval rather than an instantaneous measurement. This integration introduces motion blur and attenuates some temporal variation, but it does not guarantee alias-free motion recording.\n\nSpatial and temporal aliasing can interact. A fine texture moving across a screen may shimmer or crawl even when individual still frames appear acceptable."
    },
    {
      "heading": "Aliasing in computer graphics",
      "text": "Rendering converts a scene description into discrete pixels. Geometry, texture detail, shadows, reflections, and lighting can all vary at scales smaller than the output grid.\n\nSampling a scene only once at each pixel center can produce stair-stepped boundaries, missing thin objects, and unstable highlights. A pixel value is more appropriately understood as a filtered contribution over a finite image region, potentially also integrated over time and other rendering dimensions.\n\nAnti-aliasing techniques approximate this filtering in different ways:\n\n- Supersampling evaluates multiple samples per pixel and combines them. It can address geometry, texture, and shading variation, but increases rendering cost.\n- Multisample anti-aliasing increases coverage and depth sampling while often sharing shading calculations. It is effective for many geometric edges but does not automatically eliminate aliasing within textures or shading.\n- Texture prefiltering, including mipmaps and anisotropic filtering, reduces texture frequencies that are too fine for the projected pixel footprint.\n- Temporal anti-aliasing combines information from successive frames, often using slightly shifted sample positions. It can reduce instability but may introduce ghosting or blur when motion or visibility changes are estimated inaccurately.\n- Post-process edge smoothing modifies an already rendered image. It can soften visible stair steps, but cannot generally recover information lost during earlier sampling.\n\nIn ray tracing, distributing samples irregularly can replace conspicuous structured artifacts with noise-like error. This changes the error’s appearance rather than eliminating the need for adequate sampling and filtering."
    },
    {
      "heading": "Prevention, reconstruction, and limitations",
      "text": "An anti-aliasing system usually combines several measures.\n\nFiltering before sampling. An analog low-pass filter attenuates unwanted high frequencies before an analog-to-digital converter. In digital image resizing or sample-rate reduction, a digital filter performs the corresponding operation before samples are discarded.\n\nIncreasing the sampling rate. Higher sampling rates place spectral replicas farther apart and make practical filter design easier. Oversampling does not remove aliasing automatically: unwanted content must still be sufficiently attenuated before any later reduction in sample rate.\n\nControlling generated bandwidth. Digital oscillators, nonlinear audio processors, and rendering systems can limit or prefilter the frequencies they generate. Filtering only after aliased components have already folded into the desired band cannot generally separate them from legitimate content there.\n\nUsing prior information. Known spectral occupancy, physical constraints, or a restricted signal model can sometimes distinguish candidates that ordinary reconstruction cannot. Such recovery depends on additional assumptions; it does not make arbitrary undersampled signals uniquely recoverable.\n\nPractical filters have finite transition bands and finite attenuation. Real systems therefore specify acceptable residual aliasing rather than achieving the mathematical ideal of zero out-of-band energy.\n\nAliasing should also be distinguished from spectral leakage. Leakage occurs when observing a finite segment spreads a component’s apparent energy across frequency bins in a discrete Fourier transform. Window functions can reduce leakage, but do not undo aliasing already introduced during acquisition."
    },
    {
      "heading": "Aliasing in programming",
      "text": "In a programming language, aliasing occurs when different names, pointers, references, or access paths refer to the same object or overlapping memory. A modification through one access path may therefore be observable through another.\n\nFor example, if two variables refer to the same mutable list, appending an element through either variable changes the list seen through both. Copying a reference is not necessarily the same as copying the referenced object.\n\nThis form of aliasing is important in several areas:\n\n- Program reasoning: determining whether an update can affect another expression requires knowing whether their access paths overlap.\n- Optimization: a compiler may be unable to reorder memory operations or reuse a previously loaded value if an intervening write could change the same storage.\n- Concurrency: aliases to shared mutable data can create opportunities for a race condition unless access is appropriately coordinated.\n- Language design: ownership disciplines, borrowing rules, immutability, and restrictions on pointer use help control which aliases can exist and how they may be used.\n\nIn the C programming language, the restrict qualifier lets a programmer make specific access promises that enable optimization. Type-based aliasing rules likewise constrain certain accesses through differently typed expressions; violating the applicable rules can result in undefined behavior.\n\nProgramming aliasing and signal aliasing are distinct technical concepts. The former concerns multiple access paths to the same storage; the latter concerns multiple underlying signals becoming indistinguishable through sampling."
    }
  ],
  "links": [
    "computer-graphics",
    "nyquist-shannon-sampling-theorem",
    "fourier-transform",
    "camera",
    "image-processing",
    "pixel",
    "anti-aliasing",
    "ray-tracing",
    "discrete-fourier-transform",
    "programming-language",
    "compiler",
    "race-condition",
    "c-programming-language"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}