function r = diophantine_residual ( a, b, x )

%*****************************************************************************80
%
%% diophantine_residual() returns the residual for a Diophantine equation.
%
%  Discussion:
%
%     A Diophantine equation has the form:
%
%       a1 x1 + a2 x2 + ... + an xn = b
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 March 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer a(n): the coefficients of the Diophantine equation.
%
%    integer b: the right hand side.
%
%    integer x(n): a proposed solution to the equation.
%
%  Output:
%
%    integer r(n): the solution b - a' * x.
%
  a = a(:);
  x = x(:);

  r = b - a' * x;

  return
end

