W3docs

acosh()

Today, we will discuss the acosh() function in PHP. This function is used to get the inverse hyperbolic cosine of a number.

The PHP acosh() function returns the inverse hyperbolic cosine (also called the area hyperbolic cosine) of a number — the value whose hyperbolic cosine equals the given argument. This page covers its syntax, the valid input range, return values, edge cases, and a worked example.

Syntax

acosh(float $num): float
ParameterDescription
$numA floating-point number. It must be greater than or equal to 1 for the result to be a real number.

The return value is a float: the inverse hyperbolic cosine of $num, expressed in radians.

What acosh() Does

acosh() is the inverse of cosh(). If cosh($x) gives you $y, then acosh($y) gives you back $x. Mathematically:

acosh(x) = ln(x + sqrt(x*x - 1)),  for x >= 1

Because the hyperbolic cosine never drops below 1, the inverse is only defined for inputs >= 1. Any value below 1 falls outside the function's real domain.

Basic Example

php— editable, runs on the server

Output:

0.96242365011921

Here we pass 1.5 to acosh() and print the result in radians. You can verify it: cosh(0.96242365011921) returns 1.5.

Input Range and Edge Cases

The domain of acosh() starts at 1. Watch how the boundaries behave:

<?php
echo acosh(1) . "\n";    // smallest valid input
echo acosh(10) . "\n";   // a larger value
echo acosh(0.5) . "\n";  // below the domain
echo acosh(-2) . "\n";   // negative input
?>

Output:

0
2.9932228461264
NAN
NAN

Key points:

  • acosh(1) is exactly 0, because cosh(0) is 1.
  • Any argument less than 1 (including negatives) returns NAN ("not a number"), since the real result is undefined there.
  • Use is_nan() to detect and guard against invalid results before using them.
<?php
$value = 0.5;
$result = acosh($value);

if (is_nan($result)) {
    echo "acosh() is only defined for values >= 1.";
} else {
    echo $result;
}
?>

When Would I Use acosh()?

Hyperbolic functions show up in physics and engineering contexts — for example, the shape of a hanging cable or chain (a catenary), special relativity calculations, and certain signal-processing formulas. Whenever you have a hyperbolic-cosine value and need to recover the original argument, acosh() is the tool.

  • cosh() — hyperbolic cosine (the inverse operation).
  • asinh() — inverse hyperbolic sine.
  • atanh() — inverse hyperbolic tangent.
  • acos() — arc cosine (the circular, non-hyperbolic counterpart).

Summary

acosh() computes the inverse hyperbolic cosine of a number in radians. Pass it a value >= 1 to get a real result; anything smaller returns NAN. It pairs with cosh() as its inverse and is most useful in scientific and engineering math.

Practice

Practice
What does the 'acosh()' function in PHP do?
What does the 'acosh()' function in PHP do?
Was this page helpful?